diff --git a/sdk/compute/azure-mgmt-compute/CHANGELOG.md b/sdk/compute/azure-mgmt-compute/CHANGELOG.md index c89915566370..c1fae326e2db 100644 --- a/sdk/compute/azure-mgmt-compute/CHANGELOG.md +++ b/sdk/compute/azure-mgmt-compute/CHANGELOG.md @@ -1,5 +1,24 @@ # Release History +## 24.0.0 (2022-01-06) + +**Features** + + - Model AccessUri has a new parameter security_data_access_sas + - Model CreationData has a new parameter security_data_uri + - Model DiskRestorePoint has a new parameter replication_state + - Model DiskRestorePoint has a new parameter source_resource_location + - Model DiskSecurityProfile has a new parameter secure_vm_disk_encryption_set_id + - Model GrantAccessData has a new parameter get_secure_vm_guest_state_sas + - Model PurchasePlan has a new parameter promotion_code + - Model RestorePoint has a new parameter time_created + - Model Snapshot has a new parameter security_profile + - Model SnapshotUpdate has a new parameter supported_capabilities + +**Breaking changes** + + - Model RestorePoint no longer has parameter provisioning_details + ## 23.1.0 (2021-10-12) **Features** diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index 7f1ebd4c7888..83d8e2c50d1d 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "3eaa729b3686f20817145e771a8ab707c739dbbd", + "commit": "ac40996ab146d1360a4783665bb6c0b13f345aec", "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.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "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 --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/compute/resource-manager/readme.md" } \ No newline at end of file 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 bee3374aac89..e3ec024ccfa5 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 @@ -23,7 +23,6 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -56,21 +55,55 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-07-01' + DEFAULT_API_VERSION = '2021-08-01' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'availability_sets': '2021-07-01', + 'capacity_reservation_groups': '2021-07-01', + 'capacity_reservations': '2021-07-01', 'cloud_service_operating_systems': '2021-03-01', 'cloud_service_role_instances': '2021-03-01', 'cloud_service_roles': '2021-03-01', 'cloud_services': '2021-03-01', 'cloud_services_update_domain': '2021-03-01', - 'disk_accesses': '2021-04-01', - 'disk_encryption_sets': '2021-04-01', - 'disk_restore_point': '2021-04-01', - 'disks': '2021-04-01', - 'snapshots': '2021-04-01', + 'community_galleries': '2021-07-01', + 'community_gallery_image_versions': '2021-07-01', + 'community_gallery_images': '2021-07-01', + 'dedicated_host_groups': '2021-07-01', + 'dedicated_hosts': '2021-07-01', + 'galleries': '2021-07-01', + 'gallery_application_versions': '2021-07-01', + 'gallery_applications': '2021-07-01', + 'gallery_image_versions': '2021-07-01', + 'gallery_images': '2021-07-01', + 'gallery_sharing_profile': '2021-07-01', + 'images': '2021-07-01', + 'log_analytics': '2021-07-01', + 'operations': '2021-07-01', + 'proximity_placement_groups': '2021-07-01', + 'resource_skus': '2021-07-01', + 'restore_point_collections': '2021-07-01', + 'restore_points': '2021-07-01', + 'shared_galleries': '2021-07-01', + 'shared_gallery_image_versions': '2021-07-01', + 'shared_gallery_images': '2021-07-01', + 'ssh_public_keys': '2021-07-01', + 'usage': '2021-07-01', + 'virtual_machine_extension_images': '2021-07-01', + 'virtual_machine_extensions': '2021-07-01', + 'virtual_machine_images': '2021-07-01', + 'virtual_machine_images_edge_zone': '2021-07-01', + 'virtual_machine_run_commands': '2021-07-01', + 'virtual_machine_scale_set_extensions': '2021-07-01', + 'virtual_machine_scale_set_rolling_upgrades': '2021-07-01', + 'virtual_machine_scale_set_vm_extensions': '2021-07-01', + 'virtual_machine_scale_set_vm_run_commands': '2021-07-01', + 'virtual_machine_scale_set_vms': '2021-07-01', + 'virtual_machine_scale_sets': '2021-07-01', + 'virtual_machine_sizes': '2021-07-01', + 'virtual_machines': '2021-07-01', }}, _PROFILE_TAG + " latest" ) @@ -80,12 +113,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - if not base_url: - base_url = 'https://management.azure.com' self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(ComputeManagementClient, self).__init__( @@ -125,6 +156,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-03-01: :mod:`v2021_03_01.models` * 2021-04-01: :mod:`v2021_04_01.models` * 2021-07-01: :mod:`v2021_07_01.models` + * 2021-08-01: :mod:`v2021_08_01.models` """ if api_version == '2015-06-15': from .v2015_06_15 import models @@ -198,6 +230,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-07-01': from .v2021_07_01 import models return models + elif api_version == '2021-08-01': + from .v2021_08_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -483,6 +518,7 @@ def disk_accesses(self): * 2020-09-30: :class:`DiskAccessesOperations` * 2020-12-01: :class:`DiskAccessesOperations` * 2021-04-01: :class:`DiskAccessesOperations` + * 2021-08-01: :class:`DiskAccessesOperations` """ api_version = self._get_api_version('disk_accesses') if api_version == '2020-05-01': @@ -495,6 +531,8 @@ def disk_accesses(self): from .v2020_12_01.operations import DiskAccessesOperations as OperationClass elif api_version == '2021-04-01': from .v2021_04_01.operations import DiskAccessesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import DiskAccessesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disk_accesses'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -510,6 +548,7 @@ def disk_encryption_sets(self): * 2020-09-30: :class:`DiskEncryptionSetsOperations` * 2020-12-01: :class:`DiskEncryptionSetsOperations` * 2021-04-01: :class:`DiskEncryptionSetsOperations` + * 2021-08-01: :class:`DiskEncryptionSetsOperations` """ api_version = self._get_api_version('disk_encryption_sets') if api_version == '2019-07-01': @@ -526,6 +565,8 @@ def disk_encryption_sets(self): from .v2020_12_01.operations import DiskEncryptionSetsOperations as OperationClass elif api_version == '2021-04-01': from .v2021_04_01.operations import DiskEncryptionSetsOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import DiskEncryptionSetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disk_encryption_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -537,6 +578,7 @@ def disk_restore_point(self): * 2020-09-30: :class:`DiskRestorePointOperations` * 2020-12-01: :class:`DiskRestorePointOperations` * 2021-04-01: :class:`DiskRestorePointOperations` + * 2021-08-01: :class:`DiskRestorePointOperations` """ api_version = self._get_api_version('disk_restore_point') if api_version == '2020-09-30': @@ -545,6 +587,8 @@ def disk_restore_point(self): from .v2020_12_01.operations import DiskRestorePointOperations as OperationClass elif api_version == '2021-04-01': from .v2021_04_01.operations import DiskRestorePointOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import DiskRestorePointOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disk_restore_point'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -566,6 +610,7 @@ def disks(self): * 2020-09-30: :class:`DisksOperations` * 2020-12-01: :class:`DisksOperations` * 2021-04-01: :class:`DisksOperations` + * 2021-08-01: :class:`DisksOperations` """ api_version = self._get_api_version('disks') if api_version == '2016-04-30-preview': @@ -594,6 +639,8 @@ def disks(self): from .v2020_12_01.operations import DisksOperations as OperationClass elif api_version == '2021-04-01': from .v2021_04_01.operations import DisksOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import DisksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disks'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1060,6 +1107,7 @@ def snapshots(self): * 2020-09-30: :class:`SnapshotsOperations` * 2020-12-01: :class:`SnapshotsOperations` * 2021-04-01: :class:`SnapshotsOperations` + * 2021-08-01: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2016-04-30-preview': @@ -1088,6 +1136,8 @@ def snapshots(self): from .v2020_12_01.operations import SnapshotsOperations as OperationClass elif api_version == '2021-04-01': from .v2021_04_01.operations import SnapshotsOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".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/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_configuration.py index a6b9291ec8f6..16f6367bf086 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py index be835ed03552..a4dcb0702db7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" 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 3bb0f9418c01..c3af334c93c6 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 @@ -11,7 +11,6 @@ from typing import Any, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -54,21 +54,55 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-07-01' + DEFAULT_API_VERSION = '2021-08-01' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'availability_sets': '2021-07-01', + 'capacity_reservation_groups': '2021-07-01', + 'capacity_reservations': '2021-07-01', 'cloud_service_operating_systems': '2021-03-01', 'cloud_service_role_instances': '2021-03-01', 'cloud_service_roles': '2021-03-01', 'cloud_services': '2021-03-01', 'cloud_services_update_domain': '2021-03-01', - 'disk_accesses': '2021-04-01', - 'disk_encryption_sets': '2021-04-01', - 'disk_restore_point': '2021-04-01', - 'disks': '2021-04-01', - 'snapshots': '2021-04-01', + 'community_galleries': '2021-07-01', + 'community_gallery_image_versions': '2021-07-01', + 'community_gallery_images': '2021-07-01', + 'dedicated_host_groups': '2021-07-01', + 'dedicated_hosts': '2021-07-01', + 'galleries': '2021-07-01', + 'gallery_application_versions': '2021-07-01', + 'gallery_applications': '2021-07-01', + 'gallery_image_versions': '2021-07-01', + 'gallery_images': '2021-07-01', + 'gallery_sharing_profile': '2021-07-01', + 'images': '2021-07-01', + 'log_analytics': '2021-07-01', + 'operations': '2021-07-01', + 'proximity_placement_groups': '2021-07-01', + 'resource_skus': '2021-07-01', + 'restore_point_collections': '2021-07-01', + 'restore_points': '2021-07-01', + 'shared_galleries': '2021-07-01', + 'shared_gallery_image_versions': '2021-07-01', + 'shared_gallery_images': '2021-07-01', + 'ssh_public_keys': '2021-07-01', + 'usage': '2021-07-01', + 'virtual_machine_extension_images': '2021-07-01', + 'virtual_machine_extensions': '2021-07-01', + 'virtual_machine_images': '2021-07-01', + 'virtual_machine_images_edge_zone': '2021-07-01', + 'virtual_machine_run_commands': '2021-07-01', + 'virtual_machine_scale_set_extensions': '2021-07-01', + 'virtual_machine_scale_set_rolling_upgrades': '2021-07-01', + 'virtual_machine_scale_set_vm_extensions': '2021-07-01', + 'virtual_machine_scale_set_vm_run_commands': '2021-07-01', + 'virtual_machine_scale_set_vms': '2021-07-01', + 'virtual_machine_scale_sets': '2021-07-01', + 'virtual_machine_sizes': '2021-07-01', + 'virtual_machines': '2021-07-01', }}, _PROFILE_TAG + " latest" ) @@ -78,12 +112,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(ComputeManagementClient, self).__init__( @@ -123,6 +155,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-03-01: :mod:`v2021_03_01.models` * 2021-04-01: :mod:`v2021_04_01.models` * 2021-07-01: :mod:`v2021_07_01.models` + * 2021-08-01: :mod:`v2021_08_01.models` """ if api_version == '2015-06-15': from ..v2015_06_15 import models @@ -196,6 +229,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-07-01': from ..v2021_07_01 import models return models + elif api_version == '2021-08-01': + from ..v2021_08_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -481,6 +517,7 @@ def disk_accesses(self): * 2020-09-30: :class:`DiskAccessesOperations` * 2020-12-01: :class:`DiskAccessesOperations` * 2021-04-01: :class:`DiskAccessesOperations` + * 2021-08-01: :class:`DiskAccessesOperations` """ api_version = self._get_api_version('disk_accesses') if api_version == '2020-05-01': @@ -493,6 +530,8 @@ def disk_accesses(self): from ..v2020_12_01.aio.operations import DiskAccessesOperations as OperationClass elif api_version == '2021-04-01': from ..v2021_04_01.aio.operations import DiskAccessesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import DiskAccessesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disk_accesses'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -508,6 +547,7 @@ def disk_encryption_sets(self): * 2020-09-30: :class:`DiskEncryptionSetsOperations` * 2020-12-01: :class:`DiskEncryptionSetsOperations` * 2021-04-01: :class:`DiskEncryptionSetsOperations` + * 2021-08-01: :class:`DiskEncryptionSetsOperations` """ api_version = self._get_api_version('disk_encryption_sets') if api_version == '2019-07-01': @@ -524,6 +564,8 @@ def disk_encryption_sets(self): from ..v2020_12_01.aio.operations import DiskEncryptionSetsOperations as OperationClass elif api_version == '2021-04-01': from ..v2021_04_01.aio.operations import DiskEncryptionSetsOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import DiskEncryptionSetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disk_encryption_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -535,6 +577,7 @@ def disk_restore_point(self): * 2020-09-30: :class:`DiskRestorePointOperations` * 2020-12-01: :class:`DiskRestorePointOperations` * 2021-04-01: :class:`DiskRestorePointOperations` + * 2021-08-01: :class:`DiskRestorePointOperations` """ api_version = self._get_api_version('disk_restore_point') if api_version == '2020-09-30': @@ -543,6 +586,8 @@ def disk_restore_point(self): from ..v2020_12_01.aio.operations import DiskRestorePointOperations as OperationClass elif api_version == '2021-04-01': from ..v2021_04_01.aio.operations import DiskRestorePointOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import DiskRestorePointOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disk_restore_point'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -564,6 +609,7 @@ def disks(self): * 2020-09-30: :class:`DisksOperations` * 2020-12-01: :class:`DisksOperations` * 2021-04-01: :class:`DisksOperations` + * 2021-08-01: :class:`DisksOperations` """ api_version = self._get_api_version('disks') if api_version == '2016-04-30-preview': @@ -592,6 +638,8 @@ def disks(self): from ..v2020_12_01.aio.operations import DisksOperations as OperationClass elif api_version == '2021-04-01': from ..v2021_04_01.aio.operations import DisksOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import DisksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disks'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1058,6 +1106,7 @@ def snapshots(self): * 2020-09-30: :class:`SnapshotsOperations` * 2020-12-01: :class:`SnapshotsOperations` * 2021-04-01: :class:`SnapshotsOperations` + * 2021-08-01: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2016-04-30-preview': @@ -1086,6 +1135,8 @@ def snapshots(self): from ..v2020_12_01.aio.operations import SnapshotsOperations as OperationClass elif api_version == '2021-04-01': from ..v2021_04_01.aio.operations import SnapshotsOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".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/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_configuration.py index 04c5c5a15fc3..b48db0262c61 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py index 5b2137263749..049cfd94e3a5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py @@ -5,5 +5,5 @@ # license information. # -------------------------------------------------------------------------- from .v2021_03_01.models import * -from .v2021_04_01.models import * from .v2021_07_01.models import * +from .v2021_08_01.models import * diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py index dfc7a60fc0eb..bb142e56ede8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py @@ -6,114 +6,110 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2015_06_15.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2015_06_15.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2015_06_15.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2015_06_15.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2015_06_15.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2015_06_15.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2015_06_15.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2015_06_15.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2015_06_15.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2015_06_15.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2015_06_15.operations.VirtualMachineSizesOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2015_06_15.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2015_06_15.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2015_06_15.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2015_06_15.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2015_06_15.operations.VirtualMachineScaleSetVMsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.availability_sets = AvailabilitySetsOperations( - 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.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_sizes = VirtualMachineSizesOperations( - 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_scale_set_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations(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_scale_set_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py index 0b076e9cc55b..59395683c7dc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json index d52fd2dc4248..438225d6d456 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "availability_sets": "AvailabilitySetsOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py index a93c66696269..dd6073a05b45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py @@ -6,110 +6,111 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2015_06_15.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2015_06_15.aio.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2015_06_15.aio.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineSizesOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2015_06_15.aio.operations.VirtualMachineScaleSetVMsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations(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_scale_set_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.availability_sets = AvailabilitySetsOperations( - 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.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_sizes = VirtualMachineSizesOperations( - 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_scale_set_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py index fffef49d5293..784470dc29b8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py index 8d0ca3b6bdda..fe6a7d46bb21 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySet') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -129,27 +128,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -165,8 +154,11 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -189,27 +181,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -223,8 +205,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -235,8 +220,10 @@ def list( :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.v2015_06_15.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -244,35 +231,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -290,11 +273,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -309,8 +294,10 @@ def list_available_sizes( :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.v2015_06_15.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -318,36 +305,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -365,6 +349,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py index d3ced40d6b43..163a74f3f130 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2015_06_15.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py index aa92fab0ab49..ad30e0cca964 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py index be744d1403ba..53307b1d861d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,28 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +339,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +361,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,25 +388,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,8 +410,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -462,30 +442,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -499,4 +468,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py index 98a2f2edffaf..840ddf679186 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py index c29ffc5a3b3f..68a15a3bc1dd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_power_off_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -92,8 +87,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -111,15 +109,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -134,25 +136,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -164,6 +158,7 @@ def get_long_running_output(pipeline_response): ) 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 _deallocate_initial( @@ -178,28 +173,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -215,8 +200,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -236,15 +224,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -259,25 +251,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -289,6 +273,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -303,28 +288,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -340,8 +315,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -359,15 +337,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -382,25 +364,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -412,8 +386,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -439,28 +415,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -474,8 +440,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -501,28 +470,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -536,8 +495,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -563,8 +525,10 @@ def list( '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.v2015_06_15.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -572,42 +536,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -625,6 +586,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -642,28 +604,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -679,8 +631,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -700,15 +655,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -723,25 +682,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -753,6 +704,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -767,28 +719,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -804,8 +746,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -823,15 +768,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -846,25 +795,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -876,6 +817,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -890,28 +832,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -927,8 +859,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -946,15 +881,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -969,25 +908,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -999,4 +930,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py index c06716b92e3d..09cfc16f4a40 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_power_off_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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("name", 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -182,27 +180,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -218,8 +206,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -234,15 +225,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -256,24 +251,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -285,8 +273,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -309,27 +299,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -343,8 +323,10 @@ async def get( 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, @@ -357,35 +339,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -401,8 +373,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -419,18 +394,24 @@ async def begin_deallocate( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,27 +423,21 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -474,6 +449,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -488,32 +464,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # 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') + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -529,8 +495,11 @@ async def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -545,18 +514,24 @@ async def begin_delete_instances( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -568,27 +543,21 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,8 +569,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -624,27 +595,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -658,8 +619,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -670,8 +634,10 @@ def list( :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.v2015_06_15.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -679,35 +645,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -725,11 +687,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -739,8 +703,10 @@ def list_all( 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.v2015_06_15.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -748,34 +714,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,11 +754,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -812,8 +775,10 @@ def list_skus( :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.v2015_06_15.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -821,36 +786,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -868,6 +830,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -885,35 +848,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -929,8 +882,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -947,18 +903,24 @@ async def begin_power_off( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -970,27 +932,21 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1002,6 +958,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1016,35 +973,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1060,8 +1007,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1076,18 +1026,24 @@ async def begin_restart( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1099,27 +1055,21 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1131,6 +1081,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1145,35 +1096,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1189,8 +1130,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1205,18 +1149,24 @@ async def begin_start( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1228,27 +1178,21 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1260,6 +1204,7 @@ def get_long_running_output(pipeline_response): ) 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 _update_instances_initial( @@ -1274,32 +1219,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1315,8 +1250,11 @@ async def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1331,18 +1269,24 @@ async def begin_update_instances( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1354,27 +1298,21 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1386,6 +1324,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1399,27 +1338,17 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1435,8 +1364,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1451,15 +1383,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1473,24 +1409,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1502,4 +1431,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py index 3506ffe29801..974922aaa35b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2015_06_15.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py index 4acc491b740c..4d78b077d7a2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_list_all_request, build_list_available_sizes_request, build_list_request, build_power_off_request_initial, build_redeploy_request_initial, build_restart_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,8 +91,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -116,15 +114,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -136,27 +139,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -168,6 +165,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -182,32 +180,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -225,8 +213,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -244,15 +235,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,27 +260,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -296,6 +286,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -309,27 +300,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -345,8 +326,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -361,15 +345,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -383,24 +371,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -412,8 +393,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -427,7 +410,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -439,29 +423,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -475,8 +448,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + async def _deallocate_initial( self, resource_group_name: str, @@ -488,27 +463,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -524,8 +489,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -541,15 +509,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -563,24 +535,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -592,8 +557,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -616,27 +583,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -650,8 +607,11 @@ async def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -663,8 +623,10 @@ def list( :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.v2015_06_15.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -672,35 +634,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -718,11 +676,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -731,8 +691,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2015_06_15.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -740,34 +702,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -785,11 +742,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -804,8 +763,10 @@ def list_available_sizes( :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.v2015_06_15.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -813,36 +774,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -860,6 +818,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -876,27 +835,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -912,8 +861,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -929,15 +881,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -951,24 +907,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -980,6 +929,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -993,27 +943,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1029,8 +969,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1045,15 +988,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1067,24 +1014,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1096,6 +1036,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1109,27 +1050,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1145,8 +1076,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1161,15 +1095,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1183,24 +1121,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1212,6 +1143,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1225,27 +1157,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1261,8 +1183,11 @@ async def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1277,15 +1202,19 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1299,24 +1228,17 @@ async def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1328,4 +1250,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py index 010913c22846..fcaae5a1e669 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/__init__.py @@ -6,178 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AdditionalUnattendContent - from ._models_py3 import ApiEntityReference - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import AvailabilitySet - from ._models_py3 import AvailabilitySetListResult - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeLongRunningOperationProperties - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import HardwareProfile - from ._models_py3 import ImageReference - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - from ._models_py3 import NetworkInterfaceReference - from ._models_py3 import NetworkProfile - from ._models_py3 import OSDisk - from ._models_py3 import OSDiskImage - from ._models_py3 import OSProfile - from ._models_py3 import OperationStatusResponse - from ._models_py3 import Plan - from ._models_py3 import PurchasePlan - from ._models_py3 import Resource - from ._models_py3 import Sku - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import UpdateResource - from ._models_py3 import UpgradePolicy - from ._models_py3 import Usage - from ._models_py3 import UsageName - 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 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 VirtualMachineImage - from ._models_py3 import VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineScaleSet - from ._models_py3 import VirtualMachineScaleSetExtension - from ._models_py3 import VirtualMachineScaleSetExtensionProfile - from ._models_py3 import VirtualMachineScaleSetIPConfiguration - from ._models_py3 import VirtualMachineScaleSetInstanceView - from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary - from ._models_py3 import VirtualMachineScaleSetListResult - from ._models_py3 import VirtualMachineScaleSetListSkusResult - from ._models_py3 import VirtualMachineScaleSetListWithLinkResult - from ._models_py3 import VirtualMachineScaleSetNetworkConfiguration - from ._models_py3 import VirtualMachineScaleSetNetworkProfile - from ._models_py3 import VirtualMachineScaleSetOSDisk - from ._models_py3 import VirtualMachineScaleSetOSProfile - from ._models_py3 import VirtualMachineScaleSetSku - from ._models_py3 import VirtualMachineScaleSetSkuCapacity - from ._models_py3 import VirtualMachineScaleSetStorageProfile - from ._models_py3 import VirtualMachineScaleSetVM - 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - from ._models_py3 import VirtualMachineStatusCodeCount - from ._models_py3 import WinRMConfiguration - from ._models_py3 import WinRMListener - from ._models_py3 import WindowsConfiguration -except (SyntaxError, ImportError): - 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 AvailabilitySet # type: ignore - from ._models import AvailabilitySetListResult # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeLongRunningOperationProperties # type: ignore - from ._models import DataDisk # type: ignore - from ._models import DataDiskImage # type: ignore - from ._models import DiagnosticsProfile # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import ImageReference # type: ignore - from ._models import InnerError # type: ignore - from ._models import InstanceViewStatus # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 OSProfile # type: ignore - from ._models import OperationStatusResponse # type: ignore - from ._models import Plan # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import Resource # type: ignore - from ._models import Sku # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import UpdateResource # type: ignore - from ._models import UpgradePolicy # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageName # 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 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 VirtualMachineImage # type: ignore - from ._models import VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineScaleSet # type: ignore - from ._models import VirtualMachineScaleSetExtension # type: ignore - from ._models import VirtualMachineScaleSetExtensionProfile # type: ignore - from ._models import VirtualMachineScaleSetIPConfiguration # type: ignore - from ._models import VirtualMachineScaleSetInstanceView # type: ignore - from ._models import VirtualMachineScaleSetInstanceViewStatusesSummary # type: ignore - from ._models import VirtualMachineScaleSetListResult # type: ignore - from ._models import VirtualMachineScaleSetListSkusResult # type: ignore - from ._models import VirtualMachineScaleSetListWithLinkResult # type: ignore - from ._models import VirtualMachineScaleSetNetworkConfiguration # type: ignore - from ._models import VirtualMachineScaleSetNetworkProfile # type: ignore - from ._models import VirtualMachineScaleSetOSDisk # type: ignore - from ._models import VirtualMachineScaleSetOSProfile # type: ignore - from ._models import VirtualMachineScaleSetSku # type: ignore - from ._models import VirtualMachineScaleSetSkuCapacity # type: ignore - from ._models import VirtualMachineScaleSetStorageProfile # type: ignore - from ._models import VirtualMachineScaleSetVM # 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # type: ignore - from ._models import VirtualMachineStatusCodeCount # type: ignore - from ._models import WinRMConfiguration # type: ignore - from ._models import WinRMListener # type: ignore - from ._models import WindowsConfiguration # type: ignore +from ._models_py3 import AdditionalUnattendContent +from ._models_py3 import ApiEntityReference +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import AvailabilitySet +from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeLongRunningOperationProperties +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import HardwareProfile +from ._models_py3 import ImageReference +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +from ._models_py3 import NetworkInterfaceReference +from ._models_py3 import NetworkProfile +from ._models_py3 import OSDisk +from ._models_py3 import OSDiskImage +from ._models_py3 import OSProfile +from ._models_py3 import OperationStatusResponse +from ._models_py3 import Plan +from ._models_py3 import PurchasePlan +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import UpdateResource +from ._models_py3 import UpgradePolicy +from ._models_py3 import Usage +from ._models_py3 import UsageName +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 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 VirtualMachineImage +from ._models_py3 import VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineScaleSet +from ._models_py3 import VirtualMachineScaleSetExtension +from ._models_py3 import VirtualMachineScaleSetExtensionProfile +from ._models_py3 import VirtualMachineScaleSetIPConfiguration +from ._models_py3 import VirtualMachineScaleSetInstanceView +from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary +from ._models_py3 import VirtualMachineScaleSetListResult +from ._models_py3 import VirtualMachineScaleSetListSkusResult +from ._models_py3 import VirtualMachineScaleSetListWithLinkResult +from ._models_py3 import VirtualMachineScaleSetNetworkConfiguration +from ._models_py3 import VirtualMachineScaleSetNetworkProfile +from ._models_py3 import VirtualMachineScaleSetOSDisk +from ._models_py3 import VirtualMachineScaleSetOSProfile +from ._models_py3 import VirtualMachineScaleSetSku +from ._models_py3 import VirtualMachineScaleSetSkuCapacity +from ._models_py3 import VirtualMachineScaleSetStorageProfile +from ._models_py3 import VirtualMachineScaleSetVM +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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +from ._models_py3 import VirtualMachineStatusCodeCount +from ._models_py3 import WinRMConfiguration +from ._models_py3 import WinRMListener +from ._models_py3 import WindowsConfiguration + from ._compute_management_client_enums import ( CachingTypes, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_compute_management_client_enums.py index a7c6a9eb59e7..3e95e391f3ab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -37,7 +22,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -50,14 +35,14 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
`:code:`
` Possible values are: :code:`
`\ **http** :code:`
`:code:`
` **https** """ @@ -65,7 +50,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -73,7 +58,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -81,7 +66,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -92,14 +77,14 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTOMATIC = "Automatic" MANUAL = "Manual" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_models.py deleted file mode 100644 index 2f0fb94f0a74..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_models.py +++ /dev/null @@ -1,3130 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2015_06_15.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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2015_06_15.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2015_06_15.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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 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.v2015_06_15.models.SubResource] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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}'}, - '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]'}, - 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySet, self).__init__(**kwargs) - 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.statuses = None - - -class AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2015_06_15.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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux 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(BootDiagnosticsInstanceView, self).__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - - -class ComputeLongRunningOperationProperties(msrest.serialization.Model): - """Compute-specific operation properties, including output. - - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'output': {'key': 'output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) - self.output = kwargs.get('output', None) - - -class DataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2015_06_15.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.v2015_06_15.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.v2015_06_15.models.CachingTypes - :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.v2015_06_15.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 - """ - - _validation = { - 'lun': {'required': True}, - 'name': {'required': True}, - 'vhd': {'required': True}, - 'create_option': {'required': 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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - self.name = kwargs['name'] - self.vhd = kwargs['vhd'] - self.image = kwargs.get('image', None) - self.caching = kwargs.get('caching', None) - self.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', None) - - -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 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.v2015_06_15.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 DiskEncryptionSettings(msrest.serialization.Model): - """Describes a Encryption Settings for a Disk. - - All required parameters must be populated in order to send to Azure. - - :param disk_encryption_key: Required. Specifies the location of the disk encryption key, which - is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool - """ - - _validation = { - 'disk_encryption_key': {'required': True}, - } - - _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['disk_encryption_key'] - 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 statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskInstanceView, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.statuses = kwargs.get('statuses', None) - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
`:code:`
` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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_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_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", - "Standard_DS1", "Standard_DS2", "Standard_DS3", "Standard_DS4", "Standard_DS11", - "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_G1", "Standard_G2", "Standard_G3", - "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", - "Standard_GS5". - :type vm_size: str or ~azure.mgmt.compute.v2015_06_15.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 ImageReference(msrest.serialization.Model): - """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. - - :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 - """ - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - 'version': {'key': 'version', '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) - - -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 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.v2015_06_15.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 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.v2015_06_15.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.v2015_06_15.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 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.v2015_06_15.models.SshConfiguration - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - } - - 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) - - -class ListUsagesResult(msrest.serialization.Model): - """The List Usages operation response. - - :param value: The list of compute resource usages. - :type value: list[~azure.mgmt.compute.v2015_06_15.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 - """ - - _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.get('value', None) - self.next_link = kwargs.get('next_link', 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 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.v2015_06_15.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 OperationStatusResponse(msrest.serialization.Model): - """Operation status response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2015_06_15.models.ApiError - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResponse, self).__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = 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.v2015_06_15.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.v2015_06_15.models.DiskEncryptionSettings - :param name: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2015_06_15.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.v2015_06_15.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.v2015_06_15.models.CachingTypes - :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.v2015_06_15.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 - """ - - _validation = { - 'name': {'required': True}, - 'vhd': {'required': True}, - '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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - } - - 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['name'] - self.vhd = kwargs['vhd'] - self.image = kwargs.get('image', None) - self.caching = kwargs.get('caching', None) - self.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', 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.v2015_06_15.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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
` **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.v2015_06_15.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.v2015_06_15.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2015_06_15.models.VaultSecretGroup] - """ - - _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]'}, - } - - 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) - - -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 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 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.v2015_06_15.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 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.v2015_06_15.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.v2015_06_15.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.v2015_06_15.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 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 UpgradePolicy(msrest.serialization.Model): - """Describes an upgrade policy - automatic or manual. - - :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". - :type mode: str or ~azure.mgmt.compute.v2015_06_15.models.UpgradeMode - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradePolicy, self).__init__(**kwargs) - self.mode = kwargs.get('mode', 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: An enum describing the unit of usage measurement. Has constant 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.v2015_06_15.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 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.v2015_06_15.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2015_06_15.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.v2015_06_15.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.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.v2015_06_15.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.v2015_06_15.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: 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}, - } - - _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]'}, - 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineInstanceView'}, - 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachine, self).__init__(**kwargs) - self.plan = kwargs.get('plan', None) - self.resources = None - self.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', 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.v2015_06_15.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.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 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): - """Resource Id. - - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'output': {'key': 'properties.output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineCaptureResult, self).__init__(**kwargs) - self.output = kwargs.get('output', 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2015_06_15.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'}, - '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.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.v2015_06_15.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.v2015_06_15.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.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 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', 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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2015_06_15.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2015_06_15.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2015_06_15.models.DataDiskImage] - """ - - _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}'}, - 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2015_06_15.models.VirtualMachineAgentInstanceView - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView] - :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.v2015_06_15.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] - """ - - _attribute_map = { - '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'}, - 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.rdp_thumb_print = kwargs.get('rdp_thumb_print', None) - self.vm_agent = kwargs.get('vm_agent', None) - self.disks = kwargs.get('disks', None) - self.extensions = kwargs.get('extensions', None) - self.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', None) - - -class VirtualMachineListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machines. - :type value: list[~azure.mgmt.compute.v2015_06_15.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 - """ - - _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.get('value', None) - self.next_link = kwargs.get('next_link', 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.v2015_06_15.models.Sku - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2015_06_15.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMProfile - :param provisioning_state: The provisioning state, which only appears in the response. - :type provisioning_state: str - :param over_provision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type over_provision: 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}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'over_provision': {'key': 'properties.overProvision', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSet, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.over_provision = kwargs.get('over_provision', None) - - -class VirtualMachineScaleSetExtension(SubResource): - """Describes a Virtual Machine Scale Set Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource Id. - :type id: str - :param name: The name of the extension. - :type name: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: The type of the extension handler. - :type type: str - :param type_handler_version: The type version of the extension handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Whether the extension handler should be automatically - upgraded across minor versions. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: Json formatted protected settings for the extension. - :type protected_settings: any - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - 'settings': {'key': 'properties.settings', 'type': 'object'}, - 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) - self.name = kwargs.get('name', 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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provisioning_state = 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.v2015_06_15.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('extensions', 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.v2015_06_15.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2015_06_15.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: The subnet. - :type subnet: ~azure.mgmt.compute.v2015_06_15.models.ApiEntityReference - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2015_06_15.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2015_06_15.models.SubResource] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, - '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.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 VirtualMachineScaleSetListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine scale sets. - :type value: list[~azure.mgmt.compute.v2015_06_15.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 - """ - - _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.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -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. - - :ivar value: The list of skus available for the virtual machine scale set. - :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetSku] - :param next_link: The URI to fetch the next page of skus available for the virtual machine - scale set. Call ListNext() with this to fetch the next page of skus available for the virtual - machine scale set. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': 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 = None - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine scale sets. - :type value: list[~azure.mgmt.compute.v2015_06_15.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 - """ - - _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.get('value', None) - self.next_link = kwargs.get('next_link', 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: Whether this is a primary NIC on a virtual machine. - :type primary: bool - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetIPConfiguration] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetIPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.primary = kwargs.get('primary', None) - self.ip_configurations = kwargs.get('ip_configurations', None) - - -class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): - """Describes a virtual machine scale set network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) - 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: Required. 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.v2015_06_15.models.CachingTypes - :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.v2015_06_15.models.DiskCreateOptionTypes - :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.v2015_06_15.models.OperatingSystemTypes - :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.v2015_06_15.models.VirtualHardDisk - :param vhd_containers: The list of virtual hard disk container uris. - :type vhd_containers: list[str] - """ - - _validation = { - 'name': {'required': True}, - 'create_option': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, - 'vhd_containers': {'key': 'vhdContainers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) - self.name = kwargs['name'] - self.caching = kwargs.get('caching', None) - self.create_option = kwargs['create_option'] - self.os_type = kwargs.get('os_type', None) - self.image = kwargs.get('image', None) - self.vhd_containers = kwargs.get('vhd_containers', 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: 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.v2015_06_15.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2015_06_15.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2015_06_15.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 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.v2015_06_15.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2015_06_15.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.v2015_06_15.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: The image reference. - :type image_reference: ~azure.mgmt.compute.v2015_06_15.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetOSDisk - """ - - _attribute_map = { - 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, - 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetOSDisk'}, - } - - 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) - - -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.v2015_06_15.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.v2015_06_15.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] - :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual - machine. - :vartype latest_model_applied: bool - :ivar instance_view: The virtual machine instance view. - :vartype instance_view: - ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.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.v2015_06_15.models.SubResource - :param provisioning_state: The provisioning state, which only appears in the response. - :type provisioning_state: str - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'instance_id': {'readonly': True}, - 'sku': {'readonly': True}, - 'resources': {'readonly': True}, - 'latest_model_applied': {'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}'}, - 'instance_id': {'key': 'instanceId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'plan': {'key': 'plan', 'type': 'Plan'}, - 'resources': {'key': 'resources', 'type': '[VirtualMachineExtension]'}, - 'latest_model_applied': {'key': 'properties.latestModelApplied', 'type': 'bool'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineScaleSetVMInstanceView'}, - 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVM, self).__init__(**kwargs) - self.instance_id = None - self.sku = None - self.plan = kwargs.get('plan', None) - self.resources = None - self.latest_model_applied = None - self.instance_view = None - self.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.license_type = kwargs.get('license_type', 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.v2015_06_15.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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine scale set VM. - - :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.v2015_06_15.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView] - :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.v2015_06_15.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] - """ - - _attribute_map = { - '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'}, - 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - 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.disks = kwargs.get('disks', None) - self.extensions = kwargs.get('extensions', None) - self.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', None) - - -class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): - """The List Virtual Machine Scale Set VMs operation response. - - :param value: The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVM] - :param next_link: The URI to fetch the next page of virtual machine scale sets VMs. Call - ListNext() with this to fetch the next page of virtual machine scale sets VMs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMProfile(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.v2015_06_15.models.VirtualMachineScaleSetOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetNetworkProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetExtensionProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - } - - 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.extension_profile = kwargs.get('extension_profile', None) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = 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 virtual machine is enabled for automatic - updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :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.v2015_06_15.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2015_06_15.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2015_06_15.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2015_06_15.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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2015_06_15/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_models_py3.py index c3f8f15eece3..82f413dbb7cb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/_models_py3.py @@ -17,21 +17,21 @@ 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2015_06_15.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2015_06_15.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -50,6 +50,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2015_06_15.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -60,9 +77,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -75,6 +92,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -82,16 +104,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2015_06_15.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2015_06_15.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2015_06_15.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2015_06_15.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -112,6 +134,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2015_06_15.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2015_06_15.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -123,12 +157,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -145,6 +179,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -164,10 +206,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -192,6 +234,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -213,16 +261,16 @@ class AvailabilitySet(Resource): :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 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.v2015_06_15.models.SubResource] + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2015_06_15.models.SubResource] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ @@ -257,6 +305,19 @@ def __init__( virtual_machines: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2015_06_15.models.SubResource] + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.platform_update_domain_count = platform_update_domain_count self.platform_fault_domain_count = platform_fault_domain_count @@ -269,11 +330,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -292,6 +353,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2015_06_15.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -300,11 +368,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -319,6 +387,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -349,6 +424,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -357,8 +434,8 @@ def __init__( class ComputeLongRunningOperationProperties(msrest.serialization.Model): """Compute-specific operation properties, including output. - :param output: Operation output data (raw JSON). - :type output: any + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -371,6 +448,10 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) self.output = output @@ -380,36 +461,36 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: Required. The disk name. + :vartype name: str + :ivar vhd: Required. The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :ivar 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.v2015_06_15.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :ivar 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.v2015_06_15.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2015_06_15.models.CachingTypes + :ivar 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.v2015_06_15.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2015_06_15.models.DiskCreateOptionTypes + :ivar 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 + :vartype disk_size_gb: int """ _validation = { @@ -441,6 +522,38 @@ def __init__( disk_size_gb: Optional[int] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: Required. The disk name. + :paramtype name: str + :keyword vhd: Required. The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2015_06_15.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2015_06_15.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -473,6 +586,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -480,11 +595,11 @@ def __init__( 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 + :ivar 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.v2015_06_15.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2015_06_15.models.BootDiagnostics """ _attribute_map = { @@ -497,6 +612,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2015_06_15.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -506,13 +628,13 @@ class DiskEncryptionSettings(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param disk_encryption_key: Required. Specifies the location of the disk encryption key, which + :ivar disk_encryption_key: Required. Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _validation = { @@ -533,6 +655,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Required. Specifies the location of the disk encryption key, + which is a Key Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2015_06_15.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -542,10 +673,10 @@ def __init__( class DiskInstanceView(msrest.serialization.Model): """The instance view of the disk. - :param name: The disk name. - :type name: str - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :ivar name: The disk name. + :vartype name: str + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ _attribute_map = { @@ -560,6 +691,12 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.statuses = statuses @@ -568,7 +705,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -589,7 +726,7 @@ class HardwareProfile(msrest.serialization.Model): "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5". - :type vm_size: str or ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -602,6 +739,30 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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_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_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", + "Standard_DS1", "Standard_DS2", "Standard_DS3", "Standard_DS4", "Standard_DS11", + "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_G1", "Standard_G2", "Standard_G3", + "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", + "Standard_GS5". + :paramtype vm_size: str or ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -609,19 +770,19 @@ def __init__( class ImageReference(msrest.serialization.Model): """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. - :param publisher: The image publisher. - :type publisher: str - :param offer: Specifies the offer of the platform image or marketplace image used to create the + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -640,6 +801,21 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -650,10 +826,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -668,6 +844,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -676,16 +858,16 @@ def __init__( 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.v2015_06_15.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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2015_06_15.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -706,6 +888,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2015_06_15.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -719,10 +913,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2015_06_15.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2015_06_15.models.SubResource """ _validation = { @@ -742,6 +936,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2015_06_15.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -752,10 +952,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2015_06_15.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2015_06_15.models.SubResource """ _validation = { @@ -775,6 +975,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2015_06_15.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -783,11 +989,11 @@ def __init__( 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 + :ivar 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.v2015_06_15.models.SshConfiguration + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2015_06_15.models.SshConfiguration """ _attribute_map = { @@ -802,6 +1008,13 @@ def __init__( ssh: Optional["SshConfiguration"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2015_06_15.models.SshConfiguration + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -810,11 +1023,11 @@ def __init__( class ListUsagesResult(msrest.serialization.Model): """The List Usages operation response. - :param value: The list of compute resource usages. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.Usage] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -829,6 +1042,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2015_06_15.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -837,8 +1057,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -851,6 +1071,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -858,11 +1082,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -877,6 +1101,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -884,9 +1115,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2015_06_15.models.NetworkInterfaceReference] """ @@ -900,6 +1131,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2015_06_15.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -941,6 +1178,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusResponse, self).__init__(**kwargs) self.name = None self.status = None @@ -954,40 +1193,40 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2015_06_15.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2015_06_15.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2015_06_15.models.DiskEncryptionSettings - :param name: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2015_06_15.models.DiskEncryptionSettings + :ivar name: Required. The disk name. + :vartype name: str + :ivar vhd: Required. The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :ivar 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.v2015_06_15.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :ivar 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.v2015_06_15.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2015_06_15.models.CachingTypes + :ivar 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.v2015_06_15.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2015_06_15.models.DiskCreateOptionTypes + :ivar 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 + :vartype disk_size_gb: int """ _validation = { @@ -1020,6 +1259,42 @@ def __init__( disk_size_gb: Optional[int] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2015_06_15.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2015_06_15.models.DiskEncryptionSettings + :keyword name: Required. The disk name. + :paramtype name: str + :keyword vhd: Required. The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2015_06_15.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2015_06_15.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -1036,9 +1311,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2015_06_15.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2015_06_15.models.OperatingSystemTypes """ _validation = { @@ -1055,6 +1330,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2015_06_15.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -1062,29 +1342,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -1099,27 +1378,26 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2015_06_15.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2015_06_15.models.WindowsConfiguration + :ivar 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.v2015_06_15.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2015_06_15.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2015_06_15.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2015_06_15.models.VaultSecretGroup] """ _attribute_map = { @@ -1144,6 +1422,66 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2015_06_15.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2015_06_15.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2015_06_15.models.VaultSecretGroup] + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -1157,15 +1495,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -1184,6 +1522,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -1196,13 +1545,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -1225,6 +1574,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -1234,14 +1592,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -1258,6 +1616,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -1267,8 +1635,8 @@ def __init__( 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.v2015_06_15.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2015_06_15.models.SshPublicKey] """ _attribute_map = { @@ -1281,6 +1649,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2015_06_15.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -1288,15 +1660,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -1311,6 +1683,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -1319,21 +1702,21 @@ def __init__( 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 + :ivar 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.v2015_06_15.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2015_06_15.models.ImageReference + :ivar 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.v2015_06_15.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2015_06_15.models.OSDisk + :ivar 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.v2015_06_15.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2015_06_15.models.DataDisk] """ _attribute_map = { @@ -1350,6 +1733,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2015_06_15.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2015_06_15.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2015_06_15.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -1359,8 +1759,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1373,6 +1773,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -1380,13 +1784,13 @@ def __init__( class UpgradePolicy(msrest.serialization.Model): """Describes an upgrade policy - automatic or manual. - :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". - :type mode: str or ~azure.mgmt.compute.v2015_06_15.models.UpgradeMode + :vartype mode: str or ~azure.mgmt.compute.v2015_06_15.models.UpgradeMode """ _attribute_map = { @@ -1399,6 +1803,15 @@ def __init__( mode: Optional[Union[str, "UpgradeMode"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2015_06_15.models.UpgradeMode + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode @@ -1412,12 +1825,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2015_06_15.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2015_06_15.models.UsageName """ _validation = { @@ -1444,6 +1857,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2015_06_15.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -1453,10 +1874,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -1471,6 +1892,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -1479,21 +1906,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -1508,6 +1935,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -1516,12 +1960,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2015_06_15.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2015_06_15.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2015_06_15.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2015_06_15.models.VaultCertificate] """ _attribute_map = { @@ -1536,6 +1980,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2015_06_15.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2015_06_15.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -1544,8 +1996,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -1558,6 +2010,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -1575,30 +2031,30 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2015_06_15.models.Plan + :vartype plan: ~azure.mgmt.compute.v2015_06_15.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.models.DiagnosticsProfile + :ivar 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 @@ -1608,12 +2064,12 @@ class VirtualMachine(Resource): `_ :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.v2015_06_15.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2015_06_15.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.v2015_06_15.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -1621,7 +2077,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -1668,6 +2124,49 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2015_06_15.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2015_06_15.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -1685,13 +2184,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ _attribute_map = { @@ -1708,6 +2207,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -1719,13 +2227,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -1748,6 +2256,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -1757,10 +2274,10 @@ def __init__( class VirtualMachineCaptureResult(SubResource): """Resource Id. - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any + :ivar id: Resource Id. + :vartype id: str + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -1775,6 +2292,12 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.output = output @@ -1792,33 +2315,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2015_06_15.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -1861,6 +2385,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -1876,12 +2428,12 @@ def __init__( 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.v2015_06_15.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus """ _attribute_map = { @@ -1898,6 +2450,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -1917,23 +2477,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -1968,6 +2528,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -1979,16 +2558,16 @@ def __init__( 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.v2015_06_15.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ _attribute_map = { @@ -2009,6 +2588,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -2020,26 +2611,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -2066,6 +2657,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -2081,16 +2694,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -2114,6 +2727,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -2125,23 +2750,23 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2015_06_15.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2015_06_15.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2015_06_15.models.DataDiskImage] + :vartype plan: ~azure.mgmt.compute.v2015_06_15.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2015_06_15.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2015_06_15.models.DataDiskImage] """ _validation = { @@ -2171,6 +2796,25 @@ def __init__( data_disk_images: Optional[List["DataDiskImage"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2015_06_15.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2015_06_15.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2015_06_15.models.DataDiskImage] + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -2180,26 +2824,26 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2015_06_15.models.VirtualMachineAgentInstanceView - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineAgentInstanceView + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2015_06_15.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2015_06_15.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ _attribute_map = { @@ -2226,6 +2870,28 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineAgentInstanceView + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2015_06_15.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -2240,11 +2906,11 @@ def __init__( class VirtualMachineListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machines. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2259,6 +2925,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2277,22 +2950,22 @@ class VirtualMachineScaleSet(Resource): :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.v2015_06_15.models.Sku - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2015_06_15.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2015_06_15.models.Sku + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2015_06_15.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMProfile - :param provisioning_state: The provisioning state, which only appears in the response. - :type provisioning_state: str - :param over_provision: Specifies whether the Virtual Machine Scale Set should be + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar over_provision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. - :type over_provision: bool + :vartype over_provision: bool """ _validation = { @@ -2327,6 +3000,24 @@ def __init__( over_provision: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2015_06_15.models.Sku + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2015_06_15.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMProfile + :keyword provisioning_state: The provisioning state, which only appears in the response. + :paramtype provisioning_state: str + :keyword over_provision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype over_provision: bool + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.upgrade_policy = upgrade_policy @@ -2340,23 +3031,23 @@ class VirtualMachineScaleSetExtension(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str - :param name: The name of the extension. - :type name: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: The type of the extension handler. - :type type: str - :param type_handler_version: The type version of the extension handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Whether the extension handler should be automatically + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: The type of the extension handler. + :vartype type: str + :ivar type_handler_version: The type version of the extension handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Whether the extension handler should be automatically upgraded across minor versions. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: Json formatted protected settings for the extension. - :type protected_settings: any + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: Json formatted protected settings for the extension. + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str """ @@ -2390,6 +3081,25 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The name of the extension. + :paramtype name: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: The type of the extension handler. + :paramtype type: str + :keyword type_handler_version: The type version of the extension handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Whether the extension handler should be automatically + upgraded across minor versions. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: Json formatted protected settings for the extension. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetExtension, self).__init__(id=id, **kwargs) self.name = name self.publisher = publisher @@ -2404,8 +3114,9 @@ def __init__( 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.v2015_06_15.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -2418,6 +3129,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -2433,8 +3149,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ _validation = { @@ -2454,6 +3170,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -2482,6 +3202,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -2491,17 +3213,18 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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: The subnet. - :type subnet: ~azure.mgmt.compute.v2015_06_15.models.ApiEntityReference - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2015_06_15.models.ApiEntityReference + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2015_06_15.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2015_06_15.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2015_06_15.models.SubResource] """ _validation = { @@ -2526,6 +3249,20 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2015_06_15.models.ApiEntityReference + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2015_06_15.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2015_06_15.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -2536,11 +3273,11 @@ def __init__( class VirtualMachineScaleSetListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine scale sets. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] - :param next_link: The URI to fetch the next page of virtual machine scale sets. Call ListNext() + :ivar value: The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2555,6 +3292,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2567,10 +3311,10 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): :ivar value: The list of skus available for the virtual machine scale set. :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetSku] - :param next_link: The URI to fetch the next page of skus available for the virtual machine - scale set. Call ListNext() with this to fetch the next page of skus available for the virtual - machine scale set. - :type next_link: str + :ivar next_link: The URI to fetch the next page of skus available for the virtual machine scale + set. Call ListNext() with this to fetch the next page of skus available for the virtual machine + scale set. + :vartype next_link: str """ _validation = { @@ -2588,6 +3332,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The URI to fetch the next page of skus available for the virtual machine + scale set. Call ListNext() with this to fetch the next page of skus available for the virtual + machine scale set. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -2596,11 +3346,11 @@ def __init__( class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine scale sets. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2615,6 +3365,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2625,14 +3382,14 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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: Whether this is a primary NIC on a virtual machine. - :type primary: bool - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetIPConfiguration] """ @@ -2656,6 +3413,17 @@ def __init__( ip_configurations: Optional[List["VirtualMachineScaleSetIPConfiguration"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetIPConfiguration] + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -2665,8 +3433,8 @@ def __init__( class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -2680,6 +3448,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -2689,32 +3462,32 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The disk name. - :type name: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar name: Required. The disk name. + :vartype name: str + :ivar 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.v2015_06_15.models.CachingTypes - :param create_option: Required. Specifies how the virtual machines in the scale set should be + :vartype caching: str or ~azure.mgmt.compute.v2015_06_15.models.CachingTypes + :ivar 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.v2015_06_15.models.DiskCreateOptionTypes - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype create_option: str or ~azure.mgmt.compute.v2015_06_15.models.DiskCreateOptionTypes + :ivar 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.v2015_06_15.models.OperatingSystemTypes - :param image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before + :vartype os_type: str or ~azure.mgmt.compute.v2015_06_15.models.OperatingSystemTypes + :ivar 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.v2015_06_15.models.VirtualHardDisk - :param vhd_containers: The list of virtual hard disk container uris. - :type vhd_containers: list[str] + :vartype image: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] """ _validation = { @@ -2742,6 +3515,34 @@ def __init__( vhd_containers: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: Required. The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2015_06_15.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2015_06_15.models.DiskCreateOptionTypes + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2015_06_15.models.OperatingSystemTypes + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2015_06_15.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -2754,25 +3555,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -2787,15 +3587,15 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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: 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.v2015_06_15.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2015_06_15.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2015_06_15.models.VaultSecretGroup] + :vartype admin_password: str + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2015_06_15.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2015_06_15.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2015_06_15.models.VaultSecretGroup] """ _attribute_map = { @@ -2820,6 +3620,50 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2015_06_15.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2015_06_15.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2015_06_15.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -2859,6 +3703,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -2900,6 +3746,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -2910,10 +3758,10 @@ def __init__( class VirtualMachineScaleSetStorageProfile(msrest.serialization.Model): """Describes a virtual machine scale set storage profile. - :param image_reference: The image reference. - :type image_reference: ~azure.mgmt.compute.v2015_06_15.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetOSDisk + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2015_06_15.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetOSDisk """ _attribute_map = { @@ -2928,6 +3776,12 @@ def __init__( os_disk: Optional["VirtualMachineScaleSetOSDisk"] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2015_06_15.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetOSDisk + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -2946,20 +3800,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2015_06_15.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2015_06_15.models.Plan + :vartype plan: ~azure.mgmt.compute.v2015_06_15.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual @@ -2968,18 +3822,18 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.models.DiagnosticsProfile + :ivar 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 @@ -2989,10 +3843,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2015_06_15.models.SubResource - :param provisioning_state: The provisioning state, which only appears in the response. - :type provisioning_state: str - :param license_type: Specifies that the image or disk that is being used was licensed + :vartype availability_set: ~azure.mgmt.compute.v2015_06_15.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -3000,7 +3854,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -3053,6 +3907,51 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2015_06_15.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2015_06_15.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2015_06_15.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2015_06_15.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2015_06_15.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2015_06_15.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2015_06_15.models.SubResource + :keyword provisioning_state: The provisioning state, which only appears in the response. + :paramtype provisioning_state: str + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -3096,6 +3995,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -3104,10 +4005,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -3120,6 +4021,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -3129,8 +4036,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -3147,6 +4054,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -3154,26 +4065,26 @@ def __init__( class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): """The instance view of a virtual machine scale set VM. - :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.v2015_06_15.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineAgentInstanceView + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2015_06_15.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2015_06_15.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ _attribute_map = { @@ -3200,6 +4111,28 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineAgentInstanceView + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2015_06_15.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2015_06_15.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -3214,11 +4147,11 @@ def __init__( class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): """The List Virtual Machine Scale Set VMs operation response. - :param value: The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVM] - :param next_link: The URI to fetch the next page of virtual machine scale sets VMs. Call + :ivar value: The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVM] + :ivar next_link: The URI to fetch the next page of virtual machine scale sets VMs. Call ListNext() with this to fetch the next page of virtual machine scale sets VMs. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -3233,6 +4166,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVM] + :keyword next_link: The URI to fetch the next page of virtual machine scale sets VMs. Call + ListNext() with this to fetch the next page of virtual machine scale sets VMs. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3241,16 +4181,16 @@ def __init__( class VirtualMachineScaleSetVMProfile(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.v2015_06_15.models.VirtualMachineScaleSetOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetNetworkProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetExtensionProfile """ @@ -3270,6 +4210,19 @@ def __init__( extension_profile: Optional["VirtualMachineScaleSetExtensionProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetNetworkProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetExtensionProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -3280,20 +4233,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -3316,6 +4269,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -3328,8 +4297,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSize] """ _attribute_map = { @@ -3342,6 +4311,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -3371,6 +4344,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -3379,23 +4354,23 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2015_06_15.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2015_06_15.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2015_06_15.models.WinRMConfiguration """ _attribute_map = { @@ -3416,6 +4391,26 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + updates. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2015_06_15.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2015_06_15.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -3427,8 +4422,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2015_06_15.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2015_06_15.models.WinRMListener] """ _attribute_map = { @@ -3441,6 +4436,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2015_06_15.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -3448,18 +4447,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2015_06_15.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2015_06_15.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -3474,6 +4473,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2015_06_15.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py index d80e75617c5c..281179746831 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py @@ -5,23 +5,208 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +230,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.AvailabilitySet" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +256,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,15 +285,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -135,27 +312,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -171,15 +338,17 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -196,27 +365,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,21 +389,25 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2015_06_15.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -252,35 +415,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -298,18 +457,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -318,8 +478,10 @@ def list_available_sizes( :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.v2015_06_15.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -327,36 +489,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -374,6 +533,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py index 027c9f1825a8..9a33ba7c6763 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py index 72e92f6bd499..163b784fc964 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2015_06_15/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extensions_operations.py index ceb3061596df..76c28b4e0fb6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,197 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +221,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +266,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +293,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +319,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +345,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +391,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +414,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +444,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,43 +470,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +512,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -389,15 +534,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,25 +561,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,17 +583,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -473,30 +615,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,4 +641,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py index 057569bb7363..de5627a31634 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py index 1a038a903730..7a931865cdb9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,368 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,39 +392,28 @@ def __init__(self, client, config, serializer, deserializer): def _reimage_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,16 +429,18 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -117,15 +451,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,25 +478,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -170,43 +500,33 @@ def get_long_running_output(pipeline_response): ) 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 _deallocate_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,16 +542,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -244,15 +566,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,25 +593,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -297,43 +615,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -349,16 +657,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -369,15 +679,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -392,25 +706,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -422,16 +728,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -450,28 +757,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -485,16 +782,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -513,28 +812,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -548,18 +837,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -576,8 +867,10 @@ def list( '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.v2015_06_15.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -585,42 +878,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -638,6 +928,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -645,39 +936,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -693,16 +973,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -715,15 +997,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -738,25 +1024,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -768,43 +1046,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -820,16 +1088,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -840,15 +1110,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -863,25 +1137,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -893,43 +1159,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -945,16 +1201,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -965,15 +1223,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -988,25 +1250,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1018,4 +1272,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py index fbb5d540c66e..91baed210588 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,575 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +599,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.VirtualMachineScaleSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2015-06-15" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +642,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.VirtualMachineScaleSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineScaleSet"] + resource_group_name: str, + name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +664,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +689,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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("name", 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,41 +715,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -225,15 +755,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -242,15 +774,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,24 +800,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -293,15 +822,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -318,27 +848,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,50 +872,41 @@ def get( 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -411,16 +922,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -430,18 +943,24 @@ def begin_deallocate( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -453,27 +972,21 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -485,47 +998,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -541,16 +1044,18 @@ def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -558,18 +1063,24 @@ def begin_delete_instances( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -581,27 +1092,21 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,15 +1118,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -638,27 +1144,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -672,21 +1168,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2015_06_15.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -694,35 +1194,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -740,23 +1236,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2015_06_15.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -764,34 +1263,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -809,18 +1303,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -829,8 +1324,10 @@ def list_skus( :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.v2015_06_15.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -838,36 +1335,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -885,6 +1379,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -892,46 +1387,35 @@ def get_next(next_link=None): def _power_off_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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -947,16 +1431,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -966,18 +1452,24 @@ def begin_power_off( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -989,27 +1481,21 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1021,50 +1507,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1080,16 +1556,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1097,18 +1575,24 @@ def begin_restart( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1120,27 +1604,21 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1152,50 +1630,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1211,16 +1679,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1228,18 +1698,24 @@ def begin_start( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1251,27 +1727,21 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1283,47 +1753,37 @@ def get_long_running_output(pipeline_response): ) 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 _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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1339,16 +1799,18 @@ def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1356,18 +1818,24 @@ def begin_update_instances( :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1379,27 +1847,21 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1411,41 +1873,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1461,15 +1913,17 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1478,15 +1932,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1500,24 +1958,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1529,4 +1980,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py index 52df216dd8f8..a27f72d43750 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,19 +80,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes for a subscription in a location. :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.v2015_06_15.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -65,35 +102,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py index f9e7a5c09c65..60737c81a8eb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py @@ -5,25 +5,499 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -49,43 +523,32 @@ def __init__(self, client, config, serializer, deserializer): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,16 +564,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -122,15 +587,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2015_06_15.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -142,27 +612,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -174,47 +638,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2015-06-15" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,16 +686,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -252,15 +708,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2015_06_15.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2015_06_15.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,27 +732,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -304,41 +758,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -354,15 +798,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -371,15 +817,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -393,24 +843,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -422,23 +865,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -450,29 +895,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -486,41 +920,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + def _deallocate_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -536,15 +961,17 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses. @@ -554,15 +981,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -576,24 +1007,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -605,15 +1029,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResponse" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.OperationStatusResponse": """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -630,27 +1055,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -664,22 +1079,26 @@ def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2015_06_15.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -687,35 +1106,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -733,22 +1148,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2015_06_15.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -756,34 +1174,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -801,18 +1214,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -821,8 +1235,10 @@ def list_available_sizes( :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.v2015_06_15.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -830,36 +1246,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -877,6 +1290,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -884,37 +1298,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -930,15 +1333,17 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -948,15 +1353,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -970,24 +1379,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -999,41 +1401,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1049,15 +1441,17 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1066,15 +1460,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1088,24 +1486,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1117,41 +1508,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1167,15 +1548,17 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1184,15 +1567,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1206,24 +1593,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1235,41 +1615,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1285,15 +1655,17 @@ def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1302,15 +1674,19 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1324,24 +1700,17 @@ def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1353,4 +1722,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py index f4bc771b3d80..f8395dece2d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py @@ -6,114 +6,110 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2016_03_30.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2016_03_30.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2016_03_30.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2016_03_30.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2016_03_30.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2016_03_30.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2016_03_30.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2016_03_30.operations.VirtualMachineSizesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2016_03_30.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2016_03_30.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2016_03_30.operations.VirtualMachineScaleSetVMsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_sizes = VirtualMachineSizesOperations( - 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_scale_set_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations(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_scale_set_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py index 76cddcc0123b..ed0d26925348 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json index 0a62f84d78ec..a65634d5bb6e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "availability_sets": "AvailabilitySetsOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py index 47b11bfacd8b..baae22f61f24 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py @@ -6,110 +6,111 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2016_03_30.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2016_03_30.aio.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2016_03_30.aio.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineSizesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2016_03_30.aio.operations.VirtualMachineScaleSetVMsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations(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_scale_set_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_sizes = VirtualMachineSizesOperations( - 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_scale_set_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py index d36ae9084780..8906051ff4d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py index ef2a60f27905..8e2a29c3f6f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -129,27 +128,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -165,8 +154,11 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -189,27 +181,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -223,8 +205,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -236,8 +221,10 @@ def list_by_subscription( '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.v2016_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -245,36 +232,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -292,11 +274,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -307,8 +291,10 @@ def list( :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.v2016_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -316,35 +302,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -362,11 +344,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -381,8 +365,10 @@ def list_available_sizes( :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.v2016_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -390,36 +376,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -437,6 +420,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py index d64c5fb4ac71..93aa548e2140 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2016_03_30.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py index a4660dff833b..bdcf257570d5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py index 6c7702af9c4b..8bc8c140ab2a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,28 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +339,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +361,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,25 +388,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,8 +410,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -462,30 +442,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -499,4 +468,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py index d90215796615..f0c84fa577c5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py index ea05ea16bc61..c30a7c2e4ff5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_power_off_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -92,8 +87,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -111,15 +109,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -134,25 +136,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -164,6 +158,7 @@ def get_long_running_output(pipeline_response): ) 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 _deallocate_initial( @@ -178,28 +173,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -215,8 +200,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -236,15 +224,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -259,25 +251,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -289,6 +273,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -303,28 +288,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -340,8 +315,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -359,15 +337,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -382,25 +364,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -412,8 +386,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -439,28 +415,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -474,8 +440,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -501,28 +470,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -536,8 +495,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -563,8 +525,10 @@ def list( '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.v2016_03_30.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -572,42 +536,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -625,6 +586,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -642,28 +604,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -679,8 +631,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -700,15 +655,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -723,25 +682,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -753,6 +704,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -767,28 +719,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -804,8 +746,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -823,15 +768,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -846,25 +795,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -876,6 +817,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -890,28 +832,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -927,8 +859,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -946,15 +881,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -969,25 +908,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -999,4 +930,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py index d1a4325e7447..c6e3913d23cb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_power_off_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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("name", 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -182,27 +180,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -218,8 +206,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -234,15 +225,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -256,24 +251,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -285,8 +273,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -309,27 +299,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -343,8 +323,10 @@ async def get( 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, @@ -357,35 +339,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -401,8 +373,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -419,18 +394,24 @@ async def begin_deallocate( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,27 +423,21 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -474,6 +449,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -488,32 +464,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # 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') + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -529,8 +495,11 @@ async def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -545,18 +514,24 @@ async def begin_delete_instances( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -568,27 +543,21 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,8 +569,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -624,27 +595,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -658,8 +619,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -670,8 +634,10 @@ def list( :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.v2016_03_30.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -679,35 +645,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -725,11 +687,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -739,8 +703,10 @@ def list_all( 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.v2016_03_30.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -748,34 +714,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,11 +754,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -812,8 +775,10 @@ def list_skus( :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.v2016_03_30.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -821,36 +786,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -868,6 +830,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -885,35 +848,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -929,8 +882,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -947,18 +903,24 @@ async def begin_power_off( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -970,27 +932,21 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1002,6 +958,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1016,35 +973,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1060,8 +1007,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1076,18 +1026,24 @@ async def begin_restart( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1099,27 +1055,21 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1131,6 +1081,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1145,35 +1096,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1189,8 +1130,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1205,18 +1149,24 @@ async def begin_start( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1228,27 +1178,21 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1260,6 +1204,7 @@ def get_long_running_output(pipeline_response): ) 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 _update_instances_initial( @@ -1274,32 +1219,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1315,8 +1250,11 @@ async def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1331,18 +1269,24 @@ async def begin_update_instances( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1354,27 +1298,21 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1386,6 +1324,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1399,27 +1338,17 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1435,8 +1364,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1451,15 +1383,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1473,24 +1409,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1502,4 +1431,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py index 187f69d6d2a8..1d523dda32a3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2016_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py index c9965e16871d..7ec08c86fc78 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_extensions_request, build_get_request, build_list_all_request, build_list_available_sizes_request, build_list_request, build_power_off_request_initial, build_redeploy_request_initial, build_restart_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_extensions( self, resource_group_name: str, @@ -68,29 +74,18 @@ async def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,8 +99,10 @@ async def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + async def _capture_initial( self, resource_group_name: str, @@ -118,32 +115,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -159,8 +146,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -179,15 +169,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -199,27 +194,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -231,6 +220,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -245,32 +235,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -288,8 +268,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -307,15 +290,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -327,27 +315,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,6 +341,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -372,27 +355,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -408,8 +381,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -424,15 +400,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -446,24 +426,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -475,8 +448,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -490,7 +465,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -502,29 +478,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,8 +503,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + async def _deallocate_initial( self, resource_group_name: str, @@ -551,27 +518,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -587,8 +544,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -604,15 +564,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -626,24 +590,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,8 +612,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -679,27 +638,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -713,8 +662,11 @@ async def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -726,8 +678,10 @@ def list( :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.v2016_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -735,35 +689,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -781,11 +731,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -794,8 +746,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2016_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -803,34 +757,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -848,11 +797,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -867,8 +818,10 @@ def list_available_sizes( :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.v2016_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -876,36 +829,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -923,6 +873,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -939,27 +890,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -975,8 +916,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -992,15 +936,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1014,24 +962,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1043,6 +984,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1056,27 +998,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1092,8 +1024,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1108,15 +1043,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1130,24 +1069,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1159,6 +1091,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1172,27 +1105,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1208,8 +1131,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1224,15 +1150,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1246,24 +1176,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1275,6 +1198,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1288,27 +1212,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1324,8 +1238,11 @@ async def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1340,15 +1257,19 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1362,24 +1283,17 @@ async def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1391,4 +1305,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py index 5845455d21af..ceec73e9e5c1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/__init__.py @@ -6,184 +6,95 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AdditionalUnattendContent - from ._models_py3 import ApiEntityReference - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import AvailabilitySet - from ._models_py3 import AvailabilitySetListResult - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeLongRunningOperationProperties - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import HardwareProfile - from ._models_py3 import ImageReference - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - from ._models_py3 import NetworkInterfaceReference - from ._models_py3 import NetworkProfile - from ._models_py3 import OSDisk - from ._models_py3 import OSDiskImage - from ._models_py3 import OSProfile - from ._models_py3 import OperationStatusResponse - from ._models_py3 import Plan - from ._models_py3 import PurchasePlan - from ._models_py3 import Resource - from ._models_py3 import Sku - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import UpdateResource - from ._models_py3 import UpgradePolicy - from ._models_py3 import Usage - from ._models_py3 import UsageName - 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 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 VirtualMachineIdentity - from ._models_py3 import VirtualMachineImage - from ._models_py3 import VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineScaleSet - from ._models_py3 import VirtualMachineScaleSetExtension - from ._models_py3 import VirtualMachineScaleSetExtensionProfile - from ._models_py3 import VirtualMachineScaleSetIPConfiguration - from ._models_py3 import VirtualMachineScaleSetIdentity - from ._models_py3 import VirtualMachineScaleSetInstanceView - from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary - from ._models_py3 import VirtualMachineScaleSetListResult - from ._models_py3 import VirtualMachineScaleSetListSkusResult - from ._models_py3 import VirtualMachineScaleSetListWithLinkResult - from ._models_py3 import VirtualMachineScaleSetNetworkConfiguration - from ._models_py3 import VirtualMachineScaleSetNetworkProfile - from ._models_py3 import VirtualMachineScaleSetOSDisk - from ._models_py3 import VirtualMachineScaleSetOSProfile - from ._models_py3 import VirtualMachineScaleSetSku - from ._models_py3 import VirtualMachineScaleSetSkuCapacity - from ._models_py3 import VirtualMachineScaleSetStorageProfile - from ._models_py3 import VirtualMachineScaleSetVM - 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - from ._models_py3 import VirtualMachineStatusCodeCount - from ._models_py3 import WinRMConfiguration - from ._models_py3 import WinRMListener - from ._models_py3 import WindowsConfiguration -except (SyntaxError, ImportError): - 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 AvailabilitySet # type: ignore - from ._models import AvailabilitySetListResult # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeLongRunningOperationProperties # type: ignore - from ._models import DataDisk # type: ignore - from ._models import DataDiskImage # type: ignore - from ._models import DiagnosticsProfile # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import ImageReference # type: ignore - from ._models import InnerError # type: ignore - from ._models import InstanceViewStatus # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 OSProfile # type: ignore - from ._models import OperationStatusResponse # type: ignore - from ._models import Plan # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import Resource # type: ignore - from ._models import Sku # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import UpdateResource # type: ignore - from ._models import UpgradePolicy # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageName # 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 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 VirtualMachineIdentity # type: ignore - from ._models import VirtualMachineImage # type: ignore - from ._models import VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineScaleSet # type: ignore - from ._models import VirtualMachineScaleSetExtension # type: ignore - from ._models import VirtualMachineScaleSetExtensionProfile # type: ignore - from ._models import VirtualMachineScaleSetIPConfiguration # type: ignore - from ._models import VirtualMachineScaleSetIdentity # type: ignore - from ._models import VirtualMachineScaleSetInstanceView # type: ignore - from ._models import VirtualMachineScaleSetInstanceViewStatusesSummary # type: ignore - from ._models import VirtualMachineScaleSetListResult # type: ignore - from ._models import VirtualMachineScaleSetListSkusResult # type: ignore - from ._models import VirtualMachineScaleSetListWithLinkResult # type: ignore - from ._models import VirtualMachineScaleSetNetworkConfiguration # type: ignore - from ._models import VirtualMachineScaleSetNetworkProfile # type: ignore - from ._models import VirtualMachineScaleSetOSDisk # type: ignore - from ._models import VirtualMachineScaleSetOSProfile # type: ignore - from ._models import VirtualMachineScaleSetSku # type: ignore - from ._models import VirtualMachineScaleSetSkuCapacity # type: ignore - from ._models import VirtualMachineScaleSetStorageProfile # type: ignore - from ._models import VirtualMachineScaleSetVM # 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # type: ignore - from ._models import VirtualMachineStatusCodeCount # type: ignore - from ._models import WinRMConfiguration # type: ignore - from ._models import WinRMListener # type: ignore - from ._models import WindowsConfiguration # type: ignore +from ._models_py3 import AdditionalUnattendContent +from ._models_py3 import ApiEntityReference +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import AvailabilitySet +from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeLongRunningOperationProperties +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import HardwareProfile +from ._models_py3 import ImageReference +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +from ._models_py3 import NetworkInterfaceReference +from ._models_py3 import NetworkProfile +from ._models_py3 import OSDisk +from ._models_py3 import OSDiskImage +from ._models_py3 import OSProfile +from ._models_py3 import OperationStatusResponse +from ._models_py3 import Plan +from ._models_py3 import PurchasePlan +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import UpdateResource +from ._models_py3 import UpgradePolicy +from ._models_py3 import Usage +from ._models_py3 import UsageName +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 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 VirtualMachineIdentity +from ._models_py3 import VirtualMachineImage +from ._models_py3 import VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineScaleSet +from ._models_py3 import VirtualMachineScaleSetExtension +from ._models_py3 import VirtualMachineScaleSetExtensionProfile +from ._models_py3 import VirtualMachineScaleSetIPConfiguration +from ._models_py3 import VirtualMachineScaleSetIdentity +from ._models_py3 import VirtualMachineScaleSetInstanceView +from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary +from ._models_py3 import VirtualMachineScaleSetListResult +from ._models_py3 import VirtualMachineScaleSetListSkusResult +from ._models_py3 import VirtualMachineScaleSetListWithLinkResult +from ._models_py3 import VirtualMachineScaleSetNetworkConfiguration +from ._models_py3 import VirtualMachineScaleSetNetworkProfile +from ._models_py3 import VirtualMachineScaleSetOSDisk +from ._models_py3 import VirtualMachineScaleSetOSProfile +from ._models_py3 import VirtualMachineScaleSetSku +from ._models_py3 import VirtualMachineScaleSetSkuCapacity +from ._models_py3 import VirtualMachineScaleSetStorageProfile +from ._models_py3 import VirtualMachineScaleSetVM +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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +from ._models_py3 import VirtualMachineStatusCodeCount +from ._models_py3 import WinRMConfiguration +from ._models_py3 import WinRMListener +from ._models_py3 import WindowsConfiguration + from ._compute_management_client_enums import ( CachingTypes, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py index e2836c68ca56..ce8f4fa08a3d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -37,7 +22,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -50,14 +35,14 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -65,7 +50,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -73,7 +58,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -81,7 +66,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -92,14 +77,14 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTOMATIC = "Automatic" MANUAL = "Manual" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models.py deleted file mode 100644 index fa42feb52414..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models.py +++ /dev/null @@ -1,3273 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2016_03_30.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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2016_03_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2016_03_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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 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.v2016_03_30.models.SubResource] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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}'}, - '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]'}, - 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySet, self).__init__(**kwargs) - 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.statuses = None - - -class AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2016_03_30.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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux 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(BootDiagnosticsInstanceView, self).__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - - -class ComputeLongRunningOperationProperties(msrest.serialization.Model): - """Compute-specific operation properties, including output. - - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'output': {'key': 'output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) - self.output = kwargs.get('output', None) - - -class DataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.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.v2016_03_30.models.CachingTypes - :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.v2016_03_30.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 - """ - - _validation = { - 'lun': {'required': True}, - 'name': {'required': True}, - 'vhd': {'required': True}, - 'create_option': {'required': 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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - self.name = kwargs['name'] - self.vhd = kwargs['vhd'] - self.image = kwargs.get('image', None) - self.caching = kwargs.get('caching', None) - self.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', None) - - -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 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.v2016_03_30.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 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.v2016_03_30.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2016_03_30.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 statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskInstanceView, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.statuses = kwargs.get('statuses', None) - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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_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_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_G1", - "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", - "Standard_GS3", "Standard_GS4", "Standard_GS5". - :type vm_size: str or ~azure.mgmt.compute.v2016_03_30.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 ImageReference(msrest.serialization.Model): - """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. - - :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 - """ - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - 'version': {'key': 'version', '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) - - -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 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.v2016_03_30.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 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.v2016_03_30.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.v2016_03_30.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 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.v2016_03_30.models.SshConfiguration - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - } - - 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) - - -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.v2016_03_30.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 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 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.v2016_03_30.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 OperationStatusResponse(msrest.serialization.Model): - """Operation status response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2016_03_30.models.ApiError - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResponse, self).__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = 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.v2016_03_30.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.v2016_03_30.models.DiskEncryptionSettings - :param name: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.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.v2016_03_30.models.CachingTypes - :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.v2016_03_30.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 - """ - - _validation = { - 'name': {'required': True}, - 'vhd': {'required': True}, - '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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - } - - 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['name'] - self.vhd = kwargs['vhd'] - self.image = kwargs.get('image', None) - self.caching = kwargs.get('caching', None) - self.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', 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.v2016_03_30.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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2016_03_30.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.v2016_03_30.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] - """ - - _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]'}, - } - - 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) - - -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 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 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.v2016_03_30.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 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.v2016_03_30.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.v2016_03_30.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.v2016_03_30.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 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 UpgradePolicy(msrest.serialization.Model): - """Describes an upgrade policy - automatic or manual. - - :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". - :type mode: str or ~azure.mgmt.compute.v2016_03_30.models.UpgradeMode - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradePolicy, self).__init__(**kwargs) - self.mode = kwargs.get('mode', 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: An enum describing the unit of usage measurement. Has constant 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.v2016_03_30.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 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.v2016_03_30.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineIdentity - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.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.v2016_03_30.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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'}, - 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', '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'}, - } - - 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.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2016_03_30.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.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 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): - """Resource Id. - - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'output': {'key': 'properties.output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineCaptureResult, self).__init__(**kwargs) - self.output = kwargs.get('output', 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2016_03_30.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'}, - '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.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.v2016_03_30.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.v2016_03_30.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', 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. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the virtual machine. - :vartype tenant_id: str - :param type: The type of identity used for the virtual machine. Currently, the only supported - type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to - pass in are None and "SystemAssigned". The default value is None. - :type type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', 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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2016_03_30.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2016_03_30.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2016_03_30.models.DataDiskImage] - """ - - _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}'}, - 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2016_03_30.models.VirtualMachineAgentInstanceView - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView] - :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.v2016_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] - """ - - _attribute_map = { - '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'}, - 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.rdp_thumb_print = kwargs.get('rdp_thumb_print', None) - self.vm_agent = kwargs.get('vm_agent', None) - self.disks = kwargs.get('disks', None) - self.extensions = kwargs.get('extensions', None) - self.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2016_03_30.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 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.v2016_03_30.models.Sku - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2016_03_30.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :param over_provision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type over_provision: bool - """ - - _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}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'identity': {'key': 'identity', 'type': 'VirtualMachineScaleSetIdentity'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'over_provision': {'key': 'properties.overProvision', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSet, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.identity = kwargs.get('identity', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.provisioning_state = None - self.over_provision = kwargs.get('over_provision', None) - - -class VirtualMachineScaleSetExtension(SubResource): - """Describes a Virtual Machine Scale Set Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource Id. - :type id: str - :param name: The name of the extension. - :type name: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: The type of the extension handler. - :type type: str - :param type_handler_version: The type version of the extension handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Whether the extension handler should be automatically - upgraded across minor versions. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: Json formatted protected settings for the extension. - :type protected_settings: any - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - 'settings': {'key': 'properties.settings', 'type': 'object'}, - 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) - self.name = kwargs.get('name', 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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provisioning_state = 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.v2016_03_30.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the virtual machine scale set. - :vartype tenant_id: str - :param type: The type of identity used for the virtual machine scale set. Currently, the only - supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable - values to pass in are None and "SystemAssigned". The default value is None. - :type type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', 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.v2016_03_30.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2016_03_30.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: The subnet. - :type subnet: ~azure.mgmt.compute.v2016_03_30.models.ApiEntityReference - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: - list[~azure.mgmt.compute.v2016_03_30.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2016_03_30.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2016_03_30.models.SubResource] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, - 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', '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.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', 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 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.v2016_03_30.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.v2016_03_30.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.v2016_03_30.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 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: Whether this is a primary NIC on a virtual machine. - :type primary: bool - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetIPConfiguration] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetIPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.primary = kwargs.get('primary', None) - self.ip_configurations = kwargs.get('ip_configurations', None) - - -class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): - """Describes a virtual machine scale set network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) - 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: Required. 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.v2016_03_30.models.CachingTypes - :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.v2016_03_30.models.DiskCreateOptionTypes - :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.v2016_03_30.models.OperatingSystemTypes - :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.v2016_03_30.models.VirtualHardDisk - :param vhd_containers: The list of virtual hard disk container uris. - :type vhd_containers: list[str] - """ - - _validation = { - 'name': {'required': True}, - 'create_option': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, - 'vhd_containers': {'key': 'vhdContainers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) - self.name = kwargs['name'] - self.caching = kwargs.get('caching', None) - self.create_option = kwargs['create_option'] - self.os_type = kwargs.get('os_type', None) - self.image = kwargs.get('image', None) - self.vhd_containers = kwargs.get('vhd_containers', 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: 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.v2016_03_30.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2016_03_30.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 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.v2016_03_30.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.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: The image reference. - :type image_reference: ~azure.mgmt.compute.v2016_03_30.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetOSDisk - """ - - _attribute_map = { - 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, - 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetOSDisk'}, - } - - 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) - - -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.v2016_03_30.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.v2016_03_30.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] - :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'instance_id': {'readonly': True}, - 'sku': {'readonly': True}, - 'resources': {'readonly': True}, - 'latest_model_applied': {'readonly': True}, - 'vm_id': {'readonly': True}, - 'instance_view': {'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'}, - '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]'}, - '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'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVM, self).__init__(**kwargs) - self.instance_id = None - self.sku = None - self.plan = kwargs.get('plan', None) - self.resources = 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.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', 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) - - -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.v2016_03_30.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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine scale set VM. - - :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.v2016_03_30.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView] - :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.v2016_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] - """ - - _attribute_map = { - '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'}, - 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - 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.disks = kwargs.get('disks', None) - self.extensions = kwargs.get('extensions', None) - self.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2016_03_30.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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMProfile(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.v2016_03_30.models.VirtualMachineScaleSetOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetNetworkProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetExtensionProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - } - - 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.extension_profile = kwargs.get('extension_profile', None) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = 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 virtual machine is enabled for automatic - updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :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.v2016_03_30.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2016_03_30.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2016_03_30.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2016_03_30.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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2016_03_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models_py3.py index 82a7d3a6e9dd..264f6dd55a01 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models_py3.py @@ -17,21 +17,21 @@ 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2016_03_30.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2016_03_30.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -50,6 +50,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2016_03_30.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -60,9 +77,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -75,6 +92,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -82,16 +104,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2016_03_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2016_03_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2016_03_30.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2016_03_30.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -112,6 +134,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2016_03_30.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2016_03_30.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -123,12 +157,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -145,6 +179,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -164,10 +206,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -192,6 +234,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -213,16 +261,16 @@ class AvailabilitySet(Resource): :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 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.v2016_03_30.models.SubResource] + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2016_03_30.models.SubResource] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ @@ -257,6 +305,19 @@ def __init__( virtual_machines: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2016_03_30.models.SubResource] + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.platform_update_domain_count = platform_update_domain_count self.platform_fault_domain_count = platform_fault_domain_count @@ -269,11 +330,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -292,6 +353,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -300,11 +368,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -319,6 +387,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -349,6 +424,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -357,8 +434,8 @@ def __init__( class ComputeLongRunningOperationProperties(msrest.serialization.Model): """Compute-specific operation properties, including output. - :param output: Operation output data (raw JSON). - :type output: any + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -371,6 +448,10 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) self.output = output @@ -380,36 +461,36 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: Required. The disk name. + :vartype name: str + :ivar vhd: Required. The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :ivar 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.v2016_03_30.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :ivar 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.v2016_03_30.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2016_03_30.models.CachingTypes + :ivar 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.v2016_03_30.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2016_03_30.models.DiskCreateOptionTypes + :ivar 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 + :vartype disk_size_gb: int """ _validation = { @@ -441,6 +522,38 @@ def __init__( disk_size_gb: Optional[int] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: Required. The disk name. + :paramtype name: str + :keyword vhd: Required. The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_03_30.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2016_03_30.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -473,6 +586,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -480,11 +595,11 @@ def __init__( 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 + :ivar 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.v2016_03_30.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2016_03_30.models.BootDiagnostics """ _attribute_map = { @@ -497,6 +612,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2016_03_30.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -504,13 +626,13 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2016_03_30.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2016_03_30.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2016_03_30.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2016_03_30.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -527,6 +649,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2016_03_30.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2016_03_30.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -536,10 +667,10 @@ def __init__( class DiskInstanceView(msrest.serialization.Model): """The instance view of the disk. - :param name: The disk name. - :type name: str - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :ivar name: The disk name. + :vartype name: str + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -554,6 +685,12 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.statuses = statuses @@ -562,7 +699,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -585,7 +722,7 @@ class HardwareProfile(msrest.serialization.Model): "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5". - :type vm_size: str or ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -598,6 +735,32 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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_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_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_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS5". + :paramtype vm_size: str or ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -605,19 +768,19 @@ def __init__( class ImageReference(msrest.serialization.Model): """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. - :param publisher: The image publisher. - :type publisher: str - :param offer: Specifies the offer of the platform image or marketplace image used to create the + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -636,6 +799,21 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -646,10 +824,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -664,6 +842,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -672,16 +856,16 @@ def __init__( 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.v2016_03_30.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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2016_03_30.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -702,6 +886,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2016_03_30.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -715,10 +911,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2016_03_30.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2016_03_30.models.SubResource """ _validation = { @@ -738,6 +934,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2016_03_30.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -748,10 +950,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2016_03_30.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2016_03_30.models.SubResource """ _validation = { @@ -771,6 +973,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2016_03_30.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -779,11 +987,11 @@ def __init__( 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 + :ivar 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.v2016_03_30.models.SshConfiguration + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2016_03_30.models.SshConfiguration """ _attribute_map = { @@ -798,6 +1006,13 @@ def __init__( ssh: Optional["SshConfiguration"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2016_03_30.models.SshConfiguration + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -808,11 +1023,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2016_03_30.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -831,6 +1046,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -839,8 +1061,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -853,6 +1075,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -860,11 +1086,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -879,6 +1105,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -886,9 +1119,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2016_03_30.models.NetworkInterfaceReference] """ @@ -902,6 +1135,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2016_03_30.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -943,6 +1182,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusResponse, self).__init__(**kwargs) self.name = None self.status = None @@ -956,40 +1197,40 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2016_03_30.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2016_03_30.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2016_03_30.models.DiskEncryptionSettings - :param name: Required. The disk name. - :type name: str - :param vhd: Required. The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2016_03_30.models.DiskEncryptionSettings + :ivar name: Required. The disk name. + :vartype name: str + :ivar vhd: Required. The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :ivar 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.v2016_03_30.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :ivar 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.v2016_03_30.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2016_03_30.models.CachingTypes + :ivar 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.v2016_03_30.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2016_03_30.models.DiskCreateOptionTypes + :ivar 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 + :vartype disk_size_gb: int """ _validation = { @@ -1022,6 +1263,42 @@ def __init__( disk_size_gb: Optional[int] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_03_30.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2016_03_30.models.DiskEncryptionSettings + :keyword name: Required. The disk name. + :paramtype name: str + :keyword vhd: Required. The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_03_30.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2016_03_30.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -1038,9 +1315,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2016_03_30.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2016_03_30.models.OperatingSystemTypes """ _validation = { @@ -1057,6 +1334,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2016_03_30.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -1064,29 +1346,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -1101,27 +1382,26 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2016_03_30.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2016_03_30.models.WindowsConfiguration + :ivar 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.v2016_03_30.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] """ _attribute_map = { @@ -1146,6 +1426,66 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2016_03_30.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -1159,15 +1499,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -1186,6 +1526,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -1198,13 +1549,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -1227,6 +1578,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -1236,14 +1596,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -1260,6 +1620,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -1269,8 +1639,8 @@ def __init__( 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.v2016_03_30.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2016_03_30.models.SshPublicKey] """ _attribute_map = { @@ -1283,6 +1653,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2016_03_30.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -1290,15 +1664,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -1313,6 +1687,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -1321,21 +1706,21 @@ def __init__( 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 + :ivar 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.v2016_03_30.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2016_03_30.models.ImageReference + :ivar 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.v2016_03_30.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2016_03_30.models.OSDisk + :ivar 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.v2016_03_30.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2016_03_30.models.DataDisk] """ _attribute_map = { @@ -1352,6 +1737,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2016_03_30.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2016_03_30.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2016_03_30.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -1361,8 +1763,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1375,6 +1777,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -1382,13 +1788,13 @@ def __init__( class UpgradePolicy(msrest.serialization.Model): """Describes an upgrade policy - automatic or manual. - :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". - :type mode: str or ~azure.mgmt.compute.v2016_03_30.models.UpgradeMode + :vartype mode: str or ~azure.mgmt.compute.v2016_03_30.models.UpgradeMode """ _attribute_map = { @@ -1401,6 +1807,15 @@ def __init__( mode: Optional[Union[str, "UpgradeMode"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2016_03_30.models.UpgradeMode + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode @@ -1414,12 +1829,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2016_03_30.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2016_03_30.models.UsageName """ _validation = { @@ -1446,6 +1861,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2016_03_30.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -1455,10 +1878,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -1473,6 +1896,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -1481,21 +1910,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -1510,6 +1939,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -1518,12 +1964,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2016_03_30.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2016_03_30.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2016_03_30.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2016_03_30.models.VaultCertificate] """ _attribute_map = { @@ -1538,6 +1984,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2016_03_30.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2016_03_30.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -1546,8 +2000,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -1560,6 +2014,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -1577,32 +2035,32 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2016_03_30.models.Plan + :vartype plan: ~azure.mgmt.compute.v2016_03_30.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineIdentity - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineIdentity + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.models.DiagnosticsProfile + :ivar 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 @@ -1612,12 +2070,12 @@ class VirtualMachine(Resource): `_ :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.v2016_03_30.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2016_03_30.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.v2016_03_30.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -1625,7 +2083,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -1679,6 +2137,51 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2016_03_30.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineIdentity + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2016_03_30.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -1698,13 +2201,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -1721,6 +2224,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -1732,13 +2244,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -1761,6 +2273,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -1770,10 +2291,10 @@ def __init__( class VirtualMachineCaptureResult(SubResource): """Resource Id. - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any + :ivar id: Resource Id. + :vartype id: str + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -1788,6 +2309,12 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.output = output @@ -1805,33 +2332,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2016_03_30.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -1874,6 +2402,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -1889,12 +2445,12 @@ def __init__( 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.v2016_03_30.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus """ _attribute_map = { @@ -1911,6 +2467,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -1930,23 +2494,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -1981,6 +2545,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -1992,16 +2575,16 @@ def __init__( 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.v2016_03_30.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -2022,6 +2605,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -2033,8 +2628,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] """ _attribute_map = { @@ -2047,6 +2642,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -2054,26 +2653,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -2100,6 +2699,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -2119,10 +2740,10 @@ class VirtualMachineIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant id associated with the virtual machine. :vartype tenant_id: str - :param type: The type of identity used for the virtual machine. Currently, the only supported + :ivar type: The type of identity used for the virtual machine. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -2142,6 +2763,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of identity used for the virtual machine. Currently, the only supported + type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to + pass in are None and "SystemAssigned". The default value is None. + :paramtype type: str + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2153,16 +2780,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -2186,6 +2813,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -2197,23 +2836,23 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2016_03_30.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2016_03_30.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2016_03_30.models.DataDiskImage] + :vartype plan: ~azure.mgmt.compute.v2016_03_30.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2016_03_30.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2016_03_30.models.DataDiskImage] """ _validation = { @@ -2243,6 +2882,25 @@ def __init__( data_disk_images: Optional[List["DataDiskImage"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2016_03_30.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2016_03_30.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2016_03_30.models.DataDiskImage] + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -2252,26 +2910,26 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2016_03_30.models.VirtualMachineAgentInstanceView - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineAgentInstanceView + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2016_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2016_03_30.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -2298,6 +2956,28 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineAgentInstanceView + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2016_03_30.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -2314,11 +2994,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2016_03_30.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2337,6 +3017,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2355,24 +3042,24 @@ class VirtualMachineScaleSet(Resource): :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.v2016_03_30.models.Sku - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2016_03_30.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2016_03_30.models.Sku + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2016_03_30.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMProfile :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str - :param over_provision: Specifies whether the Virtual Machine Scale Set should be + :ivar over_provision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. - :type over_provision: bool + :vartype over_provision: bool """ _validation = { @@ -2409,6 +3096,24 @@ def __init__( over_provision: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2016_03_30.models.Sku + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2016_03_30.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMProfile + :keyword over_provision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype over_provision: bool + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity @@ -2423,23 +3128,23 @@ class VirtualMachineScaleSetExtension(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str - :param name: The name of the extension. - :type name: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: The type of the extension handler. - :type type: str - :param type_handler_version: The type version of the extension handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Whether the extension handler should be automatically + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: The type of the extension handler. + :vartype type: str + :ivar type_handler_version: The type version of the extension handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Whether the extension handler should be automatically upgraded across minor versions. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: Json formatted protected settings for the extension. - :type protected_settings: any + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: Json formatted protected settings for the extension. + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str """ @@ -2473,6 +3178,25 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The name of the extension. + :paramtype name: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: The type of the extension handler. + :paramtype type: str + :keyword type_handler_version: The type version of the extension handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Whether the extension handler should be automatically + upgraded across minor versions. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: Json formatted protected settings for the extension. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetExtension, self).__init__(id=id, **kwargs) self.name = name self.publisher = publisher @@ -2487,8 +3211,9 @@ def __init__( 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.v2016_03_30.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -2501,6 +3226,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -2514,10 +3244,10 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant id associated with the virtual machine scale set. :vartype tenant_id: str - :param type: The type of identity used for the virtual machine scale set. Currently, the only + :ivar type: The type of identity used for the virtual machine scale set. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -2537,6 +3267,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of identity used for the virtual machine scale set. Currently, the only + supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable + values to pass in are None and "SystemAssigned". The default value is None. + :paramtype type: str + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2554,8 +3290,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ _validation = { @@ -2575,6 +3311,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -2603,6 +3343,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -2612,21 +3354,21 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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: The subnet. - :type subnet: ~azure.mgmt.compute.v2016_03_30.models.ApiEntityReference - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2016_03_30.models.ApiEntityReference + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2016_03_30.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.v2016_03_30.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2016_03_30.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2016_03_30.models.SubResource] """ _validation = { @@ -2653,6 +3395,24 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2016_03_30.models.ApiEntityReference + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2016_03_30.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2016_03_30.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2016_03_30.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -2666,11 +3426,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2016_03_30.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2689,6 +3449,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2699,11 +3466,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2016_03_30.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2722,6 +3489,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2732,11 +3506,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2016_03_30.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2755,6 +3529,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2765,14 +3546,14 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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: Whether this is a primary NIC on a virtual machine. - :type primary: bool - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetIPConfiguration] """ @@ -2796,6 +3577,17 @@ def __init__( ip_configurations: Optional[List["VirtualMachineScaleSetIPConfiguration"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetIPConfiguration] + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -2805,8 +3597,8 @@ def __init__( class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -2820,6 +3612,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -2829,32 +3626,32 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The disk name. - :type name: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar name: Required. The disk name. + :vartype name: str + :ivar 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.v2016_03_30.models.CachingTypes - :param create_option: Required. Specifies how the virtual machines in the scale set should be + :vartype caching: str or ~azure.mgmt.compute.v2016_03_30.models.CachingTypes + :ivar 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.v2016_03_30.models.DiskCreateOptionTypes - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype create_option: str or ~azure.mgmt.compute.v2016_03_30.models.DiskCreateOptionTypes + :ivar 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.v2016_03_30.models.OperatingSystemTypes - :param image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before + :vartype os_type: str or ~azure.mgmt.compute.v2016_03_30.models.OperatingSystemTypes + :ivar 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.v2016_03_30.models.VirtualHardDisk - :param vhd_containers: The list of virtual hard disk container uris. - :type vhd_containers: list[str] + :vartype image: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] """ _validation = { @@ -2882,6 +3679,34 @@ def __init__( vhd_containers: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: Required. The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_03_30.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2016_03_30.models.DiskCreateOptionTypes + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_03_30.models.OperatingSystemTypes + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2016_03_30.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -2894,25 +3719,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -2927,15 +3751,15 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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: 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.v2016_03_30.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] + :vartype admin_password: str + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2016_03_30.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] """ _attribute_map = { @@ -2960,6 +3784,50 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2016_03_30.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -2999,6 +3867,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -3040,6 +3910,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -3050,10 +3922,10 @@ def __init__( class VirtualMachineScaleSetStorageProfile(msrest.serialization.Model): """Describes a virtual machine scale set storage profile. - :param image_reference: The image reference. - :type image_reference: ~azure.mgmt.compute.v2016_03_30.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetOSDisk + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2016_03_30.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetOSDisk """ _attribute_map = { @@ -3068,6 +3940,12 @@ def __init__( os_disk: Optional["VirtualMachineScaleSetOSDisk"] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2016_03_30.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetOSDisk + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -3086,20 +3964,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2016_03_30.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2016_03_30.models.Plan + :vartype plan: ~azure.mgmt.compute.v2016_03_30.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual @@ -3110,18 +3988,18 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.models.DiagnosticsProfile + :ivar 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 @@ -3131,10 +4009,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2016_03_30.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2016_03_30.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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -3142,7 +4020,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -3197,6 +4075,49 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2016_03_30.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2016_03_30.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2016_03_30.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2016_03_30.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2016_03_30.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2016_03_30.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2016_03_30.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -3241,6 +4162,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -3249,10 +4172,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -3265,6 +4188,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -3274,8 +4203,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -3292,6 +4221,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -3299,26 +4232,26 @@ def __init__( class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): """The instance view of a virtual machine scale set VM. - :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.v2016_03_30.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineAgentInstanceView + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2016_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2016_03_30.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -3345,6 +4278,28 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineAgentInstanceView + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2016_03_30.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2016_03_30.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -3361,11 +4316,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3384,6 +4339,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3392,16 +4354,16 @@ def __init__( class VirtualMachineScaleSetVMProfile(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.v2016_03_30.models.VirtualMachineScaleSetOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetNetworkProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetExtensionProfile """ @@ -3421,6 +4383,19 @@ def __init__( extension_profile: Optional["VirtualMachineScaleSetExtensionProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetNetworkProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetExtensionProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -3431,20 +4406,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -3467,6 +4442,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -3479,8 +4470,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSize] """ _attribute_map = { @@ -3493,6 +4484,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -3522,6 +4517,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -3530,23 +4527,23 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2016_03_30.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2016_03_30.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2016_03_30.models.WinRMConfiguration """ _attribute_map = { @@ -3567,6 +4564,26 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + updates. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2016_03_30.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2016_03_30.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -3578,8 +4595,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2016_03_30.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2016_03_30.models.WinRMListener] """ _attribute_map = { @@ -3592,6 +4609,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2016_03_30.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -3599,18 +4620,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2016_03_30.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2016_03_30.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -3625,6 +4646,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2016_03_30.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py index d9a1a642d0e8..9d954c610a10 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py @@ -5,23 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +265,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.AvailabilitySet" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +291,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySet') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,15 +320,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -135,27 +347,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -171,15 +373,17 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -196,27 +400,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,22 +424,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2016_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -253,36 +451,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -300,24 +493,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2016_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -325,35 +521,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -371,18 +563,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -391,8 +584,10 @@ def list_available_sizes( :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.v2016_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -400,36 +595,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -447,6 +639,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py index 9170f5d044f0..112d3ab5ef77 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py index 8698ad2d2e2f..73256bd71ed5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2016_03_30/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extensions_operations.py index dfd1e71e286a..927bc5bd55a6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,197 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +221,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +266,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +293,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +319,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +345,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +391,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +414,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +444,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,43 +470,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +512,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -389,15 +534,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,25 +561,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,17 +583,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -473,30 +615,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,4 +641,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py index 14c398ed89ed..1bab52f1780b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py index 4c00132e193b..b1c69c0b98f4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,368 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,39 +392,28 @@ def __init__(self, client, config, serializer, deserializer): def _reimage_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,16 +429,18 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -117,15 +451,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,25 +478,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -170,43 +500,33 @@ def get_long_running_output(pipeline_response): ) 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 _deallocate_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,16 +542,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -244,15 +566,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,25 +593,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -297,43 +615,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -349,16 +657,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -369,15 +679,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -392,25 +706,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -422,16 +728,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -450,28 +757,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -485,16 +782,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -513,28 +812,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -548,18 +837,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -576,8 +867,10 @@ def list( '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.v2016_03_30.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -585,42 +878,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -638,6 +928,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -645,39 +936,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -693,16 +973,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -715,15 +997,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -738,25 +1024,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -768,43 +1046,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -820,16 +1088,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -840,15 +1110,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -863,25 +1137,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -893,43 +1159,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -945,16 +1201,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -965,15 +1223,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -988,25 +1250,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1018,4 +1272,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py index aef13d65739b..1288111dd4ae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,575 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +599,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.VirtualMachineScaleSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2016-03-30" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +642,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.VirtualMachineScaleSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineScaleSet"] + resource_group_name: str, + name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +664,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +689,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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("name", 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,41 +715,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -225,15 +755,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -242,15 +774,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,24 +800,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -293,15 +822,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -318,27 +848,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,50 +872,41 @@ def get( 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -411,16 +922,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -430,18 +943,24 @@ def begin_deallocate( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -453,27 +972,21 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -485,47 +998,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -541,16 +1044,18 @@ def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -558,18 +1063,24 @@ def begin_delete_instances( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -581,27 +1092,21 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,15 +1118,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -638,27 +1144,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -672,21 +1168,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2016_03_30.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -694,35 +1194,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -740,23 +1236,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2016_03_30.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -764,34 +1263,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -809,18 +1303,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -829,8 +1324,10 @@ def list_skus( :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.v2016_03_30.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -838,36 +1335,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -885,6 +1379,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -892,46 +1387,35 @@ def get_next(next_link=None): def _power_off_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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -947,16 +1431,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -966,18 +1452,24 @@ def begin_power_off( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -989,27 +1481,21 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1021,50 +1507,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1080,16 +1556,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1097,18 +1575,24 @@ def begin_restart( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1120,27 +1604,21 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1152,50 +1630,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1211,16 +1679,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1228,18 +1698,24 @@ def begin_start( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1251,27 +1727,21 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1283,47 +1753,37 @@ def get_long_running_output(pipeline_response): ) 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 _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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1339,16 +1799,18 @@ def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1356,18 +1818,24 @@ def begin_update_instances( :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1379,27 +1847,21 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1411,41 +1873,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1461,15 +1913,17 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1478,15 +1932,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1500,24 +1958,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1529,4 +1980,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py index 38e4c322e5c0..4717b7f6e74d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,19 +80,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes for a subscription in a location. :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.v2016_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -65,35 +102,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py index a7cdab03dce1..a285b4226ca6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py @@ -5,25 +5,538 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_extensions_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,14 +560,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_extensions( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -73,29 +586,18 @@ def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,47 +611,38 @@ def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -165,16 +658,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -186,15 +681,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_03_30.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +706,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -238,47 +732,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2016-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,16 +780,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -316,15 +802,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2016_03_30.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -336,27 +826,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,41 +852,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -418,15 +892,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -435,15 +911,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,24 +937,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -486,23 +959,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -514,29 +989,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,41 +1014,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + def _deallocate_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -600,15 +1055,17 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses. @@ -618,15 +1075,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -640,24 +1101,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1123,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResponse" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.OperationStatusResponse": """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -694,27 +1149,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,22 +1173,26 @@ def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2016_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -751,35 +1200,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -797,22 +1242,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2016_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -820,34 +1268,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -865,18 +1308,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -885,8 +1329,10 @@ def list_available_sizes( :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.v2016_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -894,36 +1340,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -941,6 +1384,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -948,37 +1392,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -994,15 +1427,17 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1012,15 +1447,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1034,24 +1473,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1063,41 +1495,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1113,15 +1535,17 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1130,15 +1554,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1152,24 +1580,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1181,41 +1602,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1231,15 +1642,17 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1248,15 +1661,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1270,24 +1687,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1299,41 +1709,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-30" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1349,15 +1749,17 @@ def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1366,15 +1768,19 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1388,24 +1794,17 @@ def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1417,4 +1816,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py index 138775761743..d40709bf86c0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py @@ -6,129 +6,120 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, ImagesOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2016_04_30_preview.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2016_04_30_preview.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2016_04_30_preview.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2016_04_30_preview.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2016_04_30_preview.operations.VirtualMachineScaleSetVMsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2016_04_30_preview.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2016_04_30_preview.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - 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_sets = VirtualMachineScaleSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(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_sets = VirtualMachineScaleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py index f3b1be4b4372..e3eae507a3e3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json index 23f5d9586b89..c7fd8a485008 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "availability_sets": "AvailabilitySetsOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py index 746a0072a5f5..9ffc5aa825ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py @@ -6,125 +6,120 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, ImagesOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2016_04_30_preview.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2016_04_30_preview.aio.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2016_04_30_preview.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2016_04_30_preview.aio.operations.VirtualMachineScaleSetVMsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2016_04_30_preview.aio.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2016_04_30_preview.aio.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(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_sets = VirtualMachineScaleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - 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_sets = VirtualMachineScaleSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py index dfbcd682ab83..55eb5f49c12e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py index 1c286c0cadb0..2437b64c67ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -129,27 +128,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -165,8 +154,11 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -189,27 +181,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -223,8 +205,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -232,8 +217,10 @@ def list_by_subscription( """Lists all availability sets 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 AvailabilitySetListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -241,34 +228,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -286,11 +268,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -301,8 +285,10 @@ def list( :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.v2016_04_30_preview.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -310,35 +296,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -356,11 +338,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -375,8 +359,10 @@ def list_available_sizes( :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.v2016_04_30_preview.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -384,36 +370,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,6 +414,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py index fac80d8ed4d2..9cf3ea3e2b84 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2016_04_30_preview.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2016_04_30_preview.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,8 +380,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -428,15 +401,19 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -450,24 +427,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,8 +449,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -492,7 +464,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -500,35 +473,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -546,11 +515,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -559,7 +530,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -567,34 +539,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,6 +579,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -629,32 +597,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -670,8 +628,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -692,15 +653,20 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2016_04_30_preview.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :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 AccessUri or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -712,27 +678,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -744,6 +704,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -757,27 +718,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -793,8 +744,11 @@ async def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -811,15 +765,19 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -833,24 +791,17 @@ async def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -862,4 +813,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py index 2659c73378bf..716d17b9a461 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2016_04_30_preview.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Image] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +139,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +165,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -182,27 +179,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -218,8 +205,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -234,15 +224,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -256,24 +250,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -285,8 +272,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -312,29 +301,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -348,8 +326,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -361,7 +342,8 @@ def list_by_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.v2016_04_30_preview.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -369,35 +351,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -415,11 +393,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -429,7 +409,8 @@ def list( :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.v2016_04_30_preview.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -437,34 +418,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -482,6 +458,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py index 9775384bdea6..1fbcd48a7375 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -118,15 +116,20 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Snapshot or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -170,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -184,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -227,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -247,15 +238,20 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Snapshot or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -299,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -324,27 +316,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -358,8 +340,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -371,27 +355,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,8 +381,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -424,15 +401,19 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -446,24 +427,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -475,8 +449,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -488,7 +464,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -496,35 +473,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -542,11 +515,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -555,7 +530,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -563,34 +539,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -608,6 +579,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -625,32 +597,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -666,8 +628,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -687,15 +652,20 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2016_04_30_preview.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :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 AccessUri or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -707,27 +677,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -739,6 +703,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -752,27 +717,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -788,8 +743,11 @@ async def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -805,15 +763,19 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -827,24 +789,17 @@ async def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -856,4 +811,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py index 21e621bd95f7..7da21a1c8e89 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2016_04_30_preview.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py index 8bb2cdc43374..087402654174 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py index ca22d597620d..249df72bebaa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,18 +117,24 @@ async def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension + :type extension_parameters: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +147,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +173,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +189,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +219,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +242,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +272,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +298,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,28 +313,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +340,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +362,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,25 +389,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,8 +411,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -462,30 +443,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -499,4 +469,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py index c32f0ad2d7fc..e81e2dc2f563 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py index c4a9ae5693a1..9852e0c26fe8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_power_off_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -92,8 +87,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -111,15 +109,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -134,25 +136,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -164,6 +158,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -178,28 +173,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -215,8 +200,11 @@ async def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -235,15 +223,19 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -258,25 +250,17 @@ async def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -288,6 +272,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -302,28 +287,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -339,8 +314,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -360,15 +338,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -383,25 +365,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -413,6 +387,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -427,28 +402,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -464,8 +429,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -483,15 +451,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -506,25 +478,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -536,8 +500,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -563,28 +529,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -598,8 +554,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -625,28 +584,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -660,8 +609,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -684,8 +636,10 @@ def list( :param expand: The expand expression to apply to 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 VirtualMachineScaleSetVMListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -693,42 +647,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -746,6 +697,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -763,28 +715,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -800,8 +742,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -821,15 +766,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -844,25 +793,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -874,6 +815,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -888,28 +830,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -925,8 +857,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -944,15 +879,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -967,25 +906,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -997,6 +928,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1011,28 +943,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1048,8 +970,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1067,15 +992,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1090,25 +1019,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1120,4 +1041,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py index f1bbd50cbf4c..34980fbdbb70 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_power_off_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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("name", 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -182,27 +180,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -218,8 +206,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -234,15 +225,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -256,24 +251,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -285,8 +273,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -309,27 +299,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -343,8 +323,10 @@ async def get( 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, @@ -357,35 +339,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -401,8 +373,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -419,18 +394,24 @@ async def begin_deallocate( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,27 +423,21 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -474,6 +449,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -488,32 +464,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # 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') + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -529,8 +495,11 @@ async def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -545,18 +514,24 @@ async def begin_delete_instances( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -568,27 +543,21 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,8 +569,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -624,27 +595,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -658,8 +619,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -670,8 +634,10 @@ def list( :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.v2016_04_30_preview.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -679,35 +645,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -725,11 +687,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -739,8 +703,10 @@ def list_all( 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.v2016_04_30_preview.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -748,34 +714,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,11 +754,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -812,8 +775,10 @@ def list_skus( :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.v2016_04_30_preview.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -821,36 +786,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -868,6 +830,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -885,35 +848,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -929,8 +882,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -947,18 +903,24 @@ async def begin_power_off( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -970,27 +932,21 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1002,6 +958,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1016,35 +973,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1060,8 +1007,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1076,18 +1026,24 @@ async def begin_restart( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1099,27 +1055,21 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1131,6 +1081,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1145,35 +1096,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1189,8 +1130,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1205,18 +1149,24 @@ async def begin_start( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1228,27 +1178,21 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1260,6 +1204,7 @@ def get_long_running_output(pipeline_response): ) 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 _update_instances_initial( @@ -1274,32 +1219,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1315,8 +1250,11 @@ async def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1331,18 +1269,24 @@ async def begin_update_instances( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1354,27 +1298,21 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1386,6 +1324,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1399,27 +1338,17 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1435,8 +1364,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1451,15 +1383,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1473,24 +1409,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1502,6 +1431,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1515,27 +1445,17 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1551,8 +1471,11 @@ async def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1568,15 +1491,19 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1590,24 +1517,17 @@ async def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1619,4 +1539,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py index dff7e4386d14..d8e05988f275 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2016_04_30_preview.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py index 6850e400921d..051ebe771682 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_extensions_request, build_get_request, build_list_all_request, build_list_available_sizes_request, build_list_request, build_power_off_request_initial, build_redeploy_request_initial, build_restart_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_extensions( self, resource_group_name: str, @@ -68,29 +74,18 @@ async def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,8 +99,10 @@ async def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + async def _capture_initial( self, resource_group_name: str, @@ -118,32 +115,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -159,8 +146,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -176,18 +166,24 @@ async def begin_capture( :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.v2016_04_30_preview.models.VirtualMachineCaptureParameters + :type parameters: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -199,27 +195,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -231,6 +221,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -245,32 +236,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -288,8 +269,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -307,15 +291,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -327,27 +316,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,6 +342,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -372,27 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -408,8 +382,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -424,15 +401,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -446,24 +427,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -475,8 +449,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -490,7 +466,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -502,29 +479,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,8 +504,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + async def _convert_to_managed_disks_initial( self, resource_group_name: str, @@ -551,27 +519,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -587,8 +545,11 @@ async def _convert_to_managed_disks_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -604,15 +565,19 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -626,24 +591,17 @@ async def begin_convert_to_managed_disks( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,6 +613,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -668,27 +627,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -704,8 +653,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -721,15 +673,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -743,24 +699,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -772,8 +721,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -796,27 +747,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -830,8 +771,11 @@ async def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -843,8 +787,10 @@ def list( :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.v2016_04_30_preview.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -852,35 +798,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -898,11 +840,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -911,8 +855,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2016_04_30_preview.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -920,34 +866,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -965,11 +906,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -984,8 +927,10 @@ def list_available_sizes( :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.v2016_04_30_preview.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -993,36 +938,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1040,6 +982,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1056,27 +999,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1092,8 +1025,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1109,15 +1045,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1131,24 +1071,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1160,6 +1093,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1173,27 +1107,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1209,8 +1133,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1225,15 +1152,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1247,24 +1178,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1276,6 +1200,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1289,27 +1214,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1325,8 +1240,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1341,15 +1259,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1363,24 +1285,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1392,6 +1307,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1405,27 +1321,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1441,8 +1347,11 @@ async def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1457,15 +1366,19 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1479,24 +1392,17 @@ async def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1508,4 +1414,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py index 80ec93e50e38..d4037ab4a287 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/__init__.py @@ -6,232 +6,119 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import AdditionalUnattendContent - from ._models_py3 import ApiEntityReference - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import AvailabilitySet - from ._models_py3 import AvailabilitySetListResult - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeLongRunningOperationProperties - from ._models_py3 import CreationData - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import Disk - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskUpdate - from ._models_py3 import EncryptionSettings - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDiskReference - from ._models_py3 import ImageListResult - from ._models_py3 import ImageOSDisk - from ._models_py3 import ImageReference - from ._models_py3 import ImageStorageProfile - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - 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 OSProfile - from ._models_py3 import OperationStatusResponse - from ._models_py3 import Plan - from ._models_py3 import PurchasePlan - from ._models_py3 import Resource - from ._models_py3 import ResourceUpdate - from ._models_py3 import Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import UpdateResource - from ._models_py3 import UpgradePolicy - from ._models_py3 import Usage - from ._models_py3 import UsageName - 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 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 VirtualMachineIdentity - from ._models_py3 import VirtualMachineImage - from ._models_py3 import VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineScaleSet - from ._models_py3 import VirtualMachineScaleSetDataDisk - from ._models_py3 import VirtualMachineScaleSetExtension - from ._models_py3 import VirtualMachineScaleSetExtensionProfile - from ._models_py3 import VirtualMachineScaleSetIPConfiguration - from ._models_py3 import VirtualMachineScaleSetIdentity - from ._models_py3 import VirtualMachineScaleSetInstanceView - from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary - 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 VirtualMachineScaleSetNetworkProfile - from ._models_py3 import VirtualMachineScaleSetOSDisk - from ._models_py3 import VirtualMachineScaleSetOSProfile - from ._models_py3 import VirtualMachineScaleSetSku - from ._models_py3 import VirtualMachineScaleSetSkuCapacity - from ._models_py3 import VirtualMachineScaleSetStorageProfile - from ._models_py3 import VirtualMachineScaleSetVM - 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - from ._models_py3 import VirtualMachineStatusCodeCount - from ._models_py3 import WinRMConfiguration - from ._models_py3 import WinRMListener - from ._models_py3 import WindowsConfiguration -except (SyntaxError, ImportError): - from ._models import AccessUri # 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 AvailabilitySet # type: ignore - from ._models import AvailabilitySetListResult # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeLongRunningOperationProperties # type: ignore - from ._models import CreationData # type: ignore - from ._models import DataDisk # type: ignore - from ._models import DataDiskImage # type: ignore - from ._models import DiagnosticsProfile # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import EncryptionSettings # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import Image # type: ignore - from ._models import ImageDataDisk # type: ignore - from ._models import ImageDiskReference # 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 InnerError # type: ignore - from ._models import InstanceViewStatus # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 OSProfile # type: ignore - from ._models import OperationStatusResponse # type: ignore - from ._models import Plan # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceUpdate # type: ignore - from ._models import Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import UpdateResource # type: ignore - from ._models import UpgradePolicy # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageName # 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 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 VirtualMachineIdentity # type: ignore - from ._models import VirtualMachineImage # type: ignore - from ._models import VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineScaleSet # type: ignore - from ._models import VirtualMachineScaleSetDataDisk # type: ignore - from ._models import VirtualMachineScaleSetExtension # type: ignore - from ._models import VirtualMachineScaleSetExtensionProfile # type: ignore - from ._models import VirtualMachineScaleSetIPConfiguration # type: ignore - from ._models import VirtualMachineScaleSetIdentity # type: ignore - from ._models import VirtualMachineScaleSetInstanceView # type: ignore - from ._models import VirtualMachineScaleSetInstanceViewStatusesSummary # 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 VirtualMachineScaleSetNetworkProfile # type: ignore - from ._models import VirtualMachineScaleSetOSDisk # type: ignore - from ._models import VirtualMachineScaleSetOSProfile # type: ignore - from ._models import VirtualMachineScaleSetSku # type: ignore - from ._models import VirtualMachineScaleSetSkuCapacity # type: ignore - from ._models import VirtualMachineScaleSetStorageProfile # type: ignore - from ._models import VirtualMachineScaleSetVM # 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # type: ignore - from ._models import VirtualMachineStatusCodeCount # type: ignore - from ._models import WinRMConfiguration # type: ignore - from ._models import WinRMListener # type: ignore - from ._models import WindowsConfiguration # type: ignore +from ._models_py3 import AccessUri +from ._models_py3 import AdditionalUnattendContent +from ._models_py3 import ApiEntityReference +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import AvailabilitySet +from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeLongRunningOperationProperties +from ._models_py3 import CreationData +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import Disk +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskUpdate +from ._models_py3 import EncryptionSettings +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDiskReference +from ._models_py3 import ImageListResult +from ._models_py3 import ImageOSDisk +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +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 OSProfile +from ._models_py3 import OperationStatusResponse +from ._models_py3 import Plan +from ._models_py3 import PurchasePlan +from ._models_py3 import Resource +from ._models_py3 import ResourceUpdate +from ._models_py3 import Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import UpdateResource +from ._models_py3 import UpgradePolicy +from ._models_py3 import Usage +from ._models_py3 import UsageName +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 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 VirtualMachineIdentity +from ._models_py3 import VirtualMachineImage +from ._models_py3 import VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineScaleSet +from ._models_py3 import VirtualMachineScaleSetDataDisk +from ._models_py3 import VirtualMachineScaleSetExtension +from ._models_py3 import VirtualMachineScaleSetExtensionProfile +from ._models_py3 import VirtualMachineScaleSetIPConfiguration +from ._models_py3 import VirtualMachineScaleSetIdentity +from ._models_py3 import VirtualMachineScaleSetInstanceView +from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary +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 VirtualMachineScaleSetNetworkProfile +from ._models_py3 import VirtualMachineScaleSetOSDisk +from ._models_py3 import VirtualMachineScaleSetOSProfile +from ._models_py3 import VirtualMachineScaleSetSku +from ._models_py3 import VirtualMachineScaleSetSkuCapacity +from ._models_py3 import VirtualMachineScaleSetStorageProfile +from ._models_py3 import VirtualMachineScaleSetVM +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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +from ._models_py3 import VirtualMachineStatusCodeCount +from ._models_py3 import WinRMConfiguration +from ._models_py3 import WinRMListener +from ._models_py3 import WindowsConfiguration + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_compute_management_client_enums.py index b662a3c717c7..7319ce556728 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_compute_management_client_enums.py @@ -6,32 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -42,7 +27,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -53,7 +38,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COPY = "Copy" RESTORE = "Restore" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -66,21 +51,21 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ GENERALIZED = "Generalized" SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -88,7 +73,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -96,7 +81,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -104,7 +89,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. """ @@ -112,7 +97,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_LRS = "Standard_LRS" PREMIUM_LRS = "Premium_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -123,14 +108,14 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTOMATIC = "Automatic" MANUAL = "Manual" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_models.py deleted file mode 100644 index 9ba7793e42cb..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_models.py +++ /dev/null @@ -1,4265 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'properties.output.accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = 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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2016_04_30_preview.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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2016_04_30_preview.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2016_04_30_preview.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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. - :type sku: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.models.SubResource] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] - :param managed: If the availability set supports managed disks. - :type managed: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, - 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, - 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, - 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, - 'managed': {'key': 'properties.managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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.statuses = None - self.managed = kwargs.get('managed', None) - - -class AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux 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(BootDiagnosticsInstanceView, self).__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - - -class ComputeLongRunningOperationProperties(msrest.serialization.Model): - """Compute-specific operation properties, including output. - - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'output': {'key': 'output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) - self.output = kwargs.get('output', None) - - -class CreationData(msrest.serialization.Model): - """Data used when creating a disk. - - All required parameters must be populated in order to send to Azure. - - :param create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". - :type create_option: str or ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of - the storage account containing the blob to import as a disk. Required only if the blob is in a - different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageDiskReference - :param source_uri: If createOption is Import, this is a SAS URI to a blob to be imported into a - managed disk. If createOption is Copy, this is a relative Uri containing the id of the source - snapshot to be copied into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point. - :type source_resource_id: str - """ - - _validation = { - 'create_option': {'required': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - - -class DataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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.v2016_04_30_preview.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.v2016_04_30_preview.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.v2016_04_30_preview.models.CachingTypes - :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.v2016_04_30_preview.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.v2016_04_30_preview.models.ManagedDiskParameters - """ - - _validation = { - 'lun': {'required': True}, - 'create_option': {'required': 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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - } - - def __init__( - self, - **kwargs - ): - 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.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - - -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 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.v2016_04_30_preview.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 Disk(Resource): - """Disk resource. - - 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 account_type: the storage account type of the disk. Possible values include: - "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings - :ivar owner_id: A relative URI containing the VM id that has the disk attached. - :vartype owner_id: str - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'time_created': {'readonly': True}, - 'owner_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'owner_id': {'key': 'properties.ownerId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.account_type = kwargs.get('account_type', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.owner_id = None - self.provisioning_state = None - - -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.v2016_04_30_preview.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2016_04_30_preview.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 statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskInstanceView, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.statuses = kwargs.get('statuses', None) - - -class DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] - :param next_link: the uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ResourceUpdate(msrest.serialization.Model): - """The 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(ResourceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DiskUpdate(ResourceUpdate): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param account_type: the storage account type of the disk. Possible values include: - "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.account_type = kwargs.get('account_type', None) - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class EncryptionSettings(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: - ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: - ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettings, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2016_04_30_preview.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 `_. 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_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_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_G1", - "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", - "Standard_GS3", "Standard_GS4", "Standard_GS5". - :type vm_size: str or ~azure.mgmt.compute.v2016_04_30_preview.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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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}'}, - 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Image, 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 - - -class ImageDataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.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 - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - 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) - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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.v2016_04_30_preview.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(msrest.serialization.Model): - """Describes an Operating System disk. - - All required parameters must be populated in order to send to Azure. - - :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.v2016_04_30_preview.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.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 - """ - - _validation = { - 'os_type': {'required': True}, - 'os_state': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_state': {'key': 'osState', 'type': 'str'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageOSDisk, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.os_state = kwargs['os_state'] - 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) - - -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 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. - - :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 - """ - - _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'}, - } - - 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) - - -class ImageStorageProfile(msrest.serialization.Model): - """Describes a storage profile. - - All required parameters must be populated in order to send to Azure. - - :param os_disk: Required. 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.v2016_04_30_preview.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.v2016_04_30_preview.models.ImageDataDisk] - """ - - _validation = { - 'os_disk': {'required': True}, - } - - _attribute_map = { - 'os_disk': {'key': 'osDisk', 'type': 'ImageOSDisk'}, - 'data_disks': {'key': 'dataDisks', 'type': '[ImageDataDisk]'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageStorageProfile, self).__init__(**kwargs) - self.os_disk = kwargs['os_disk'] - self.data_disks = kwargs.get('data_disks', 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 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.v2016_04_30_preview.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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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.v2016_04_30_preview.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.v2016_04_30_preview.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 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.v2016_04_30_preview.models.SshConfiguration - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - } - - 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) - - -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.v2016_04_30_preview.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 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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or - ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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.v2016_04_30_preview.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 OperationStatusResponse(msrest.serialization.Model): - """Operation status response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2016_04_30_preview.models.ApiError - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResponse, self).__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = 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.v2016_04_30_preview.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.v2016_04_30_preview.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.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.v2016_04_30_preview.models.CachingTypes - :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.v2016_04_30_preview.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.v2016_04_30_preview.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'}, - '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.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.v2016_04_30_preview.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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2016_04_30_preview.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.v2016_04_30_preview.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultSecretGroup] - """ - - _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]'}, - } - - 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) - - -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 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 Sku(msrest.serialization.Model): - """Describes a virtual machine scale set sku. - - :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 Snapshot(Resource): - """Snapshot resource. - - 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 account_type: the storage account type of the disk. Possible values include: - "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings - :ivar owner_id: A relative URI containing the VM id that has the disk attached. - :vartype owner_id: str - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'time_created': {'readonly': True}, - 'owner_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'owner_id': {'key': 'properties.ownerId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.account_type = kwargs.get('account_type', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.owner_id = None - self.provisioning_state = None - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotUpdate(ResourceUpdate): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param account_type: the storage account type of the disk. Possible values include: - "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.account_type = kwargs.get('account_type', None) - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', 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.v2016_04_30_preview.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 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.v2016_04_30_preview.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.v2016_04_30_preview.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.v2016_04_30_preview.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 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 UpgradePolicy(msrest.serialization.Model): - """Describes an upgrade policy - automatic or manual. - - :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". - :type mode: str or ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradeMode - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradePolicy, self).__init__(**kwargs) - self.mode = kwargs.get('mode', 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: An enum describing the unit of usage measurement. Has constant 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.v2016_04_30_preview.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 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 - :code:``.crt for the X509 certificate file and - :code:``.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.v2016_04_30_preview.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: - list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineIdentity - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.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.v2016_04_30_preview.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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'}, - 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', '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'}, - } - - 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.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2016_04_30_preview.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.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 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): - """Resource Id. - - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'output': {'key': 'properties.output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineCaptureResult, self).__init__(**kwargs) - self.output = kwargs.get('output', 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2016_04_30_preview.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'}, - '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.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.v2016_04_30_preview.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.v2016_04_30_preview.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', 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. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the virtual machine. - :vartype tenant_id: str - :param type: The type of identity used for the virtual machine. Currently, the only supported - type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to - pass in are None and "SystemAssigned". The default value is None. - :type type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', 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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2016_04_30_preview.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2016_04_30_preview.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2016_04_30_preview.models.DataDiskImage] - """ - - _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}'}, - 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2016_04_30_preview.models.VirtualMachineAgentInstanceView - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView] - :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.v2016_04_30_preview.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] - """ - - _attribute_map = { - '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'}, - 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.rdp_thumb_print = kwargs.get('rdp_thumb_print', None) - self.vm_agent = kwargs.get('vm_agent', None) - self.disks = kwargs.get('disks', None) - self.extensions = kwargs.get('extensions', None) - self.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2016_04_30_preview.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 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.v2016_04_30_preview.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.v2016_04_30_preview.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :param over_provision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type over_provision: bool - :param single_placement_group: When true this limits the scale set to a single placement group, - of max size 100 virtual machines. - :type single_placement_group: bool - """ - - _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}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'plan': {'key': 'plan', 'type': 'Plan'}, - 'identity': {'key': 'identity', 'type': 'VirtualMachineScaleSetIdentity'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'over_provision': {'key': 'properties.overProvision', 'type': 'bool'}, - 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, - } - - 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.upgrade_policy = kwargs.get('upgrade_policy', None) - self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.provisioning_state = None - self.over_provision = kwargs.get('over_provision', None) - self.single_placement_group = kwargs.get('single_placement_group', 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.v2016_04_30_preview.models.CachingTypes - :param create_option: Required. The create option. Possible values include: "FromImage", - "Empty", "Attach". - :type create_option: str or - ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, - } - - 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.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', 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 - :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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - 'settings': {'key': 'properties.settings', 'type': 'object'}, - 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) - self.name = kwargs.get('name', 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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provisioning_state = 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.v2016_04_30_preview.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the virtual machine scale set. - :vartype tenant_id: str - :param type: The type of identity used for the virtual machine scale set. Currently, the only - supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable - values to pass in are None and "SystemAssigned". The default value is None. - :type type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', 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.v2016_04_30_preview.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2016_04_30_preview.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: The subnet. - :type subnet: ~azure.mgmt.compute.v2016_04_30_preview.models.ApiEntityReference - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: - list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: - list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, - 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', '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.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', 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 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.v2016_04_30_preview.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.v2016_04_30_preview.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.v2016_04_30_preview.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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or - ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - """ - - _attribute_map = { - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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: Whether this is a primary NIC on a virtual machine. - :type primary: bool - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetIPConfiguration] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetIPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.primary = kwargs.get('primary', None) - self.ip_configurations = kwargs.get('ip_configurations', None) - - -class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): - """Describes a virtual machine scale set network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) - 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.v2016_04_30_preview.models.CachingTypes - :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.v2016_04_30_preview.models.DiskCreateOptionTypes - :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.v2016_04_30_preview.models.OperatingSystemTypes - :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.v2016_04_30_preview.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.v2016_04_30_preview.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _validation = { - 'create_option': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - '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.create_option = kwargs['create_option'] - 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: 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.v2016_04_30_preview.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2016_04_30_preview.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2016_04_30_preview.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 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.v2016_04_30_preview.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: - ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.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: The image reference. - :type image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetOSDisk - :param data_disks: The data disks. - :type data_disks: - list[~azure.mgmt.compute.v2016_04_30_preview.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 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.v2016_04_30_preview.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.v2016_04_30_preview.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: - list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] - :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'instance_id': {'readonly': True}, - 'sku': {'readonly': True}, - 'resources': {'readonly': True}, - 'latest_model_applied': {'readonly': True}, - 'vm_id': {'readonly': True}, - 'instance_view': {'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'}, - '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]'}, - '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'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVM, self).__init__(**kwargs) - self.instance_id = None - self.sku = None - self.plan = kwargs.get('plan', None) - self.resources = 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.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', 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) - - -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.v2016_04_30_preview.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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine scale set VM. - - :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.v2016_04_30_preview.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView] - :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.v2016_04_30_preview.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] - :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 - """ - - _attribute_map = { - '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'}, - 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.disks = kwargs.get('disks', None) - self.extensions = kwargs.get('extensions', None) - self.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', None) - self.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMProfile(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.v2016_04_30_preview.models.VirtualMachineScaleSetOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetNetworkProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetExtensionProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - } - - 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.extension_profile = kwargs.get('extension_profile', None) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = 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 virtual machine is enabled for automatic - updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :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.v2016_04_30_preview.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2016_04_30_preview.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2016_04_30_preview.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2016_04_30_preview.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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2016_04_30_preview/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_models_py3.py index 019c3cf83170..cde46a93b572 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,21 +44,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2016_04_30_preview.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2016_04_30_preview.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -75,6 +77,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2016_04_30_preview.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -85,9 +104,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -100,6 +119,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -107,16 +131,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2016_04_30_preview.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2016_04_30_preview.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2016_04_30_preview.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2016_04_30_preview.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -137,6 +161,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2016_04_30_preview.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2016_04_30_preview.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -148,12 +184,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -170,6 +206,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -189,10 +233,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -217,6 +261,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -238,22 +288,22 @@ class AvailabilitySet(Resource): :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. - :type sku: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.models.SubResource] + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2016_04_30_preview.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] - :param managed: If the availability set supports managed disks. - :type managed: bool + :ivar managed: If the availability set supports managed disks. + :vartype managed: bool """ _validation = { @@ -290,6 +340,23 @@ def __init__( managed: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2016_04_30_preview.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] + :keyword managed: If the availability set supports managed disks. + :paramtype managed: bool + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -304,11 +371,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -327,6 +394,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -335,11 +409,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -354,6 +428,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -384,6 +465,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -392,8 +475,8 @@ def __init__( class ComputeLongRunningOperationProperties(msrest.serialization.Model): """Compute-specific operation properties, including output. - :param output: Operation output data (raw JSON). - :type output: any + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -406,6 +489,10 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) self.output = output @@ -415,22 +502,22 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". - :type create_option: str or ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of + :vartype create_option: str or ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOption + :ivar storage_account_id: If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageDiskReference - :param source_uri: If createOption is Import, this is a SAS URI to a blob to be imported into a + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is a SAS URI to a blob to be imported into a managed disk. If createOption is Copy, this is a relative Uri containing the id of the source snapshot to be copied into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. If createOption is Restore, this is the ARM-like id of the source disk restore point. + :vartype source_resource_id: str """ _validation = { @@ -455,6 +542,25 @@ def __init__( source_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". + :paramtype create_option: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOption + :keyword storage_account_id: If createOption is Import, the Azure Resource Manager identifier + of the storage account containing the blob to import as a disk. Required only if the blob is in + a different subscription. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is a SAS URI to a blob to be imported into + a managed disk. If createOption is Copy, this is a relative Uri containing the id of the source + snapshot to be copied into a managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point. + :paramtype source_resource_id: str + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -468,39 +574,39 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2016_04_30_preview.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :ivar 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.v2016_04_30_preview.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :ivar 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.v2016_04_30_preview.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :ivar 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 + :vartype create_option: str or ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :ivar 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.v2016_04_30_preview.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.ManagedDiskParameters """ _validation = { @@ -532,6 +638,41 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :keyword 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". + :paramtype create_option: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.ManagedDiskParameters + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -565,6 +706,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -572,11 +715,11 @@ def __init__( 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 + :ivar 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.v2016_04_30_preview.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2016_04_30_preview.models.BootDiagnostics """ _attribute_map = { @@ -589,6 +732,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2016_04_30_preview.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -606,27 +756,28 @@ class Disk(Resource): :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 account_type: the storage account type of the disk. Possible values include: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar account_type: the storage account type of the disk. Possible values include: "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :vartype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings :ivar owner_id: A relative URI containing the VM id that has the disk attached. :vartype owner_id: str :ivar provisioning_state: The disk provisioning state. @@ -671,6 +822,29 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword account_type: the storage account type of the disk. Possible values include: + "Standard_LRS", "Premium_LRS". + :paramtype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: + ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.account_type = account_type self.time_created = None @@ -685,14 +859,15 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: + :vartype disk_encryption_key: ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: + ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -709,6 +884,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: + ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -718,10 +904,10 @@ def __init__( class DiskInstanceView(msrest.serialization.Model): """The instance view of the disk. - :param name: The disk name. - :type name: str - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :ivar name: The disk name. + :vartype name: str + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] """ _attribute_map = { @@ -736,6 +922,12 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.statuses = statuses @@ -746,11 +938,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] - :param next_link: the uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] + :ivar next_link: the uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -769,6 +961,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] + :keyword next_link: the uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -777,8 +976,8 @@ def __init__( class ResourceUpdate(msrest.serialization.Model): """The Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -791,6 +990,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ResourceUpdate, self).__init__(**kwargs) self.tags = tags @@ -798,23 +1001,24 @@ def __init__( class DiskUpdate(ResourceUpdate): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param account_type: the storage account type of the disk. Possible values include: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar account_type: the storage account type of the disk. Possible values include: "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: disk source information. CreationData information cannot be changed after + :vartype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :ivar creation_data: disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings """ _attribute_map = { @@ -837,6 +1041,27 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword account_type: the storage account type of the disk. Possible values include: + "Standard_LRS", "Premium_LRS". + :paramtype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :keyword creation_data: disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: + ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + """ super(DiskUpdate, self).__init__(tags=tags, **kwargs) self.account_type = account_type self.os_type = os_type @@ -848,16 +1073,16 @@ def __init__( class EncryptionSettings(msrest.serialization.Model): """Encryption settings for disk or snapshot. - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: + :vartype enabled: bool + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :vartype key_encryption_key: ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultAndKeyReference """ @@ -875,6 +1100,19 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword enabled: Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :paramtype key_encryption_key: + ~azure.mgmt.compute.v2016_04_30_preview.models.KeyVaultAndKeyReference + """ super(EncryptionSettings, self).__init__(**kwargs) self.enabled = enabled self.disk_encryption_key = disk_encryption_key @@ -886,10 +1124,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2016_04_30_preview.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read". + :vartype access: str or ~azure.mgmt.compute.v2016_04_30_preview.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -909,6 +1147,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read". + :paramtype access: str or ~azure.mgmt.compute.v2016_04_30_preview.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -917,7 +1161,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -938,7 +1182,7 @@ class HardwareProfile(msrest.serialization.Model): "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5". - :type vm_size: str or ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -951,6 +1195,31 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 `_. 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_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_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_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS5". + :paramtype vm_size: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -968,14 +1237,14 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -1008,6 +1277,16 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageStorageProfile + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1019,26 +1298,26 @@ class ImageDataDisk(msrest.serialization.Model): 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 + :ivar 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype lun: int + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2016_04_30_preview.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :ivar 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 + :vartype disk_size_gb: int """ _validation = { @@ -1065,6 +1344,28 @@ def __init__( disk_size_gb: Optional[int] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + """ super(ImageDataDisk, self).__init__(**kwargs) self.lun = lun self.snapshot = snapshot @@ -1079,12 +1380,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -1103,6 +1404,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -1113,11 +1422,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2016_04_30_preview.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1136,6 +1445,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1146,29 +1462,30 @@ class ImageOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. This property allows you to specify the type of the OS that is + :ivar 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.v2016_04_30_preview.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemStateTypes + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2016_04_30_preview.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :ivar 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 + :vartype disk_size_gb: int """ _validation = { @@ -1198,6 +1515,33 @@ def __init__( disk_size_gb: Optional[int] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemStateTypes + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + """ super(ImageOSDisk, self).__init__(**kwargs) self.os_type = os_type self.os_state = os_state @@ -1211,8 +1555,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1225,6 +1569,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1232,21 +1580,21 @@ def __init__( 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. - :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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -1267,6 +1615,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -1279,16 +1644,16 @@ class ImageStorageProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_disk: Required. Specifies information about the operating system disk used by the + :ivar os_disk: Required. 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.v2016_04_30_preview.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageOSDisk + :ivar 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.v2016_04_30_preview.models.ImageDataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.ImageDataDisk] """ _validation = { @@ -1307,6 +1672,18 @@ def __init__( data_disks: Optional[List["ImageDataDisk"]] = None, **kwargs ): + """ + :keyword os_disk: Required. 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.ImageDataDisk] + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -1315,10 +1692,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -1333,6 +1710,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -1341,16 +1724,16 @@ def __init__( 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.v2016_04_30_preview.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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -1371,6 +1754,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -1384,10 +1779,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -1407,6 +1802,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -1417,10 +1818,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -1440,6 +1841,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -1450,10 +1857,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2016_04_30_preview.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource """ _validation = { @@ -1473,6 +1880,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -1483,10 +1896,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2016_04_30_preview.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource """ _validation = { @@ -1506,6 +1919,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -1514,11 +1933,11 @@ def __init__( 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 + :ivar 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.v2016_04_30_preview.models.SshConfiguration + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2016_04_30_preview.models.SshConfiguration """ _attribute_map = { @@ -1533,6 +1952,13 @@ def __init__( ssh: Optional["SshConfiguration"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2016_04_30_preview.models.SshConfiguration + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -1543,11 +1969,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2016_04_30_preview.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1566,6 +1992,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1574,12 +2007,12 @@ def __init__( 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. Possible + :ivar id: Resource Id. + :vartype id: str + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or + :vartype storage_account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes """ @@ -1595,6 +2028,15 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type @@ -1602,11 +2044,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -1621,6 +2063,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -1628,9 +2077,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2016_04_30_preview.models.NetworkInterfaceReference] """ @@ -1644,6 +2093,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2016_04_30_preview.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -1685,6 +2140,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusResponse, self).__init__(**kwargs) self.name = None self.status = None @@ -1698,44 +2155,44 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2016_04_30_preview.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: + :vartype encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :ivar 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.v2016_04_30_preview.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :ivar 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.v2016_04_30_preview.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :ivar 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 + :vartype create_option: str or ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :ivar 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.v2016_04_30_preview.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.ManagedDiskParameters """ _validation = { @@ -1768,6 +2225,46 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + ~azure.mgmt.compute.v2016_04_30_preview.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :keyword 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". + :paramtype create_option: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -1785,9 +2282,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or + :vartype operating_system: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes """ @@ -1805,6 +2302,12 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -1812,29 +2315,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -1849,28 +2351,27 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: + :vartype windows_configuration: ~azure.mgmt.compute.v2016_04_30_preview.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :ivar 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.v2016_04_30_preview.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2016_04_30_preview.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultSecretGroup] """ _attribute_map = { @@ -1895,6 +2396,68 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: + ~azure.mgmt.compute.v2016_04_30_preview.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: + ~azure.mgmt.compute.v2016_04_30_preview.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultSecretGroup] + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -1908,15 +2471,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -1935,6 +2498,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -1947,13 +2521,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -1976,6 +2550,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -1985,14 +2568,14 @@ def __init__( class Sku(msrest.serialization.Model): """Describes a virtual machine scale set sku. - :param name: The sku name. - :type name: str - :param tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -2009,6 +2592,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2028,27 +2621,28 @@ class Snapshot(Resource): :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 account_type: the storage account type of the disk. Possible values include: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar account_type: the storage account type of the disk. Possible values include: "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :vartype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings :ivar owner_id: A relative URI containing the VM id that has the disk attached. :vartype owner_id: str :ivar provisioning_state: The disk provisioning state. @@ -2093,6 +2687,29 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword account_type: the storage account type of the disk. Possible values include: + "Standard_LRS", "Premium_LRS". + :paramtype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: + ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.account_type = account_type self.time_created = None @@ -2109,11 +2726,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2132,6 +2749,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2140,23 +2764,24 @@ def __init__( class SnapshotUpdate(ResourceUpdate): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param account_type: the storage account type of the disk. Possible values include: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar account_type: the storage account type of the disk. Possible values include: "Standard_LRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes - :param creation_data: disk source information. CreationData information cannot be changed after + :vartype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :ivar creation_data: disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings """ _attribute_map = { @@ -2179,6 +2804,27 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword account_type: the storage account type of the disk. Possible values include: + "Standard_LRS", "Premium_LRS". + :paramtype account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :keyword creation_data: disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2016_04_30_preview.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: + ~azure.mgmt.compute.v2016_04_30_preview.models.EncryptionSettings + """ super(SnapshotUpdate, self).__init__(tags=tags, **kwargs) self.account_type = account_type self.os_type = os_type @@ -2190,8 +2836,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2204,6 +2850,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -2211,8 +2861,8 @@ def __init__( 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.v2016_04_30_preview.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2016_04_30_preview.models.SshPublicKey] """ _attribute_map = { @@ -2225,6 +2875,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2016_04_30_preview.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -2232,15 +2886,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -2255,6 +2909,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -2263,21 +2928,21 @@ def __init__( 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 + :ivar 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.v2016_04_30_preview.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageReference + :ivar 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.v2016_04_30_preview.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.OSDisk + :ivar 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.v2016_04_30_preview.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DataDisk] """ _attribute_map = { @@ -2294,6 +2959,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -2321,6 +3003,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -2328,8 +3012,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -2342,6 +3026,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -2349,13 +3037,13 @@ def __init__( class UpgradePolicy(msrest.serialization.Model): """Describes an upgrade policy - automatic or manual. - :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". - :type mode: str or ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradeMode + :vartype mode: str or ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradeMode """ _attribute_map = { @@ -2368,6 +3056,15 @@ def __init__( mode: Optional[Union[str, "UpgradeMode"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradeMode + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode @@ -2381,12 +3078,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2016_04_30_preview.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2016_04_30_preview.models.UsageName """ _validation = { @@ -2413,6 +3110,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2016_04_30_preview.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -2422,10 +3127,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -2440,6 +3145,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -2448,21 +3159,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 :code:``.crt for the X509 certificate file and :code:``.prv for private key. Both of these files are .pem formatted. - :type certificate_store: str + :vartype certificate_store: str """ _attribute_map = { @@ -2477,6 +3188,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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 + :code:``.crt for the X509 certificate file and + :code:``.prv for private key. Both of these files are .pem formatted. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -2485,12 +3213,13 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultCertificate] + :vartype vault_certificates: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultCertificate] """ _attribute_map = { @@ -2505,6 +3234,15 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -2513,8 +3251,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -2527,6 +3265,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -2544,33 +3286,33 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2016_04_30_preview.models.Plan + :vartype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineIdentity - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineIdentity + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.DiagnosticsProfile + :ivar 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 @@ -2580,13 +3322,13 @@ class VirtualMachine(Resource): `_ :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.v2016_04_30_preview.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2016_04_30_preview.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.v2016_04_30_preview.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -2594,7 +3336,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -2648,6 +3390,52 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineIdentity + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: + ~azure.mgmt.compute.v2016_04_30_preview.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -2667,13 +3455,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] """ _attribute_map = { @@ -2690,6 +3478,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -2701,13 +3498,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -2730,6 +3527,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -2739,10 +3545,10 @@ def __init__( class VirtualMachineCaptureResult(SubResource): """Resource Id. - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any + :ivar id: Resource Id. + :vartype id: str + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -2757,6 +3563,12 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.output = output @@ -2774,33 +3586,33 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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: + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView """ @@ -2844,6 +3656,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -2859,12 +3699,12 @@ def __init__( 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.v2016_04_30_preview.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus """ _attribute_map = { @@ -2881,6 +3721,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -2900,23 +3748,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -2951,6 +3799,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -2962,16 +3829,16 @@ def __init__( 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.v2016_04_30_preview.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] """ _attribute_map = { @@ -2992,6 +3859,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -3003,8 +3882,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] """ _attribute_map = { @@ -3017,6 +3896,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -3024,26 +3907,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -3070,6 +3953,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -3089,10 +3994,10 @@ class VirtualMachineIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant id associated with the virtual machine. :vartype tenant_id: str - :param type: The type of identity used for the virtual machine. Currently, the only supported + :ivar type: The type of identity used for the virtual machine. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -3112,6 +4017,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of identity used for the virtual machine. Currently, the only supported + type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to + pass in are None and "SystemAssigned". The default value is None. + :paramtype type: str + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -3123,16 +4034,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -3156,6 +4067,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -3167,23 +4090,23 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2016_04_30_preview.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2016_04_30_preview.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2016_04_30_preview.models.DataDiskImage] + :vartype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2016_04_30_preview.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2016_04_30_preview.models.DataDiskImage] """ _validation = { @@ -3213,6 +4136,25 @@ def __init__( data_disk_images: Optional[List["DataDiskImage"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2016_04_30_preview.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2016_04_30_preview.models.DataDiskImage] + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -3222,27 +4164,28 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2016_04_30_preview.models.VirtualMachineAgentInstanceView - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineAgentInstanceView + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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: + :vartype boot_diagnostics: ~azure.mgmt.compute.v2016_04_30_preview.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] """ _attribute_map = { @@ -3269,6 +4212,30 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineAgentInstanceView + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: + ~azure.mgmt.compute.v2016_04_30_preview.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -3285,11 +4252,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2016_04_30_preview.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3308,6 +4275,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3326,33 +4300,34 @@ class VirtualMachineScaleSet(Resource): :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.v2016_04_30_preview.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2016_04_30_preview.models.Sku + :ivar 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.v2016_04_30_preview.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMProfile :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str - :param over_provision: Specifies whether the Virtual Machine Scale Set should be + :ivar over_provision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. - :type over_provision: bool - :param single_placement_group: When true this limits the scale set to a single placement group, + :vartype over_provision: bool + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool + :vartype single_placement_group: bool """ _validation = { @@ -3393,6 +4368,34 @@ def __init__( single_placement_group: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2016_04_30_preview.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2016_04_30_preview.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMProfile + :keyword over_provision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype over_provision: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -3409,28 +4412,28 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2016_04_30_preview.models.CachingTypes - :param create_option: Required. The create option. Possible values include: "FromImage", + :vartype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or + :vartype create_option: str or ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -3459,6 +4462,31 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -3475,23 +4503,23 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar name: The name of the extension. + :vartype name: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str """ @@ -3525,6 +4553,25 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3539,8 +4586,8 @@ def __init__( 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: + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetExtension] """ @@ -3554,6 +4601,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -3567,10 +4619,10 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant id associated with the virtual machine scale set. :vartype tenant_id: str - :param type: The type of identity used for the virtual machine scale set. Currently, the only + :ivar type: The type of identity used for the virtual machine scale set. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -3590,6 +4642,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of identity used for the virtual machine scale set. Currently, the only + supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable + values to pass in are None and "SystemAssigned". The default value is None. + :paramtype type: str + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -3607,8 +4665,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] """ _validation = { @@ -3628,6 +4686,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -3656,6 +4718,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -3665,21 +4729,20 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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: The subnet. - :type subnet: ~azure.mgmt.compute.v2016_04_30_preview.models.ApiEntityReference - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2016_04_30_preview.models.ApiEntityReference + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] """ @@ -3707,6 +4770,24 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2016_04_30_preview.models.ApiEntityReference + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2016_04_30_preview.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -3720,11 +4801,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2016_04_30_preview.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3743,6 +4824,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3753,11 +4841,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2016_04_30_preview.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3776,6 +4864,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3786,11 +4882,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2016_04_30_preview.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3809,6 +4905,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3817,10 +4920,10 @@ def __init__( 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. Possible + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or + :vartype storage_account_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes """ @@ -3834,6 +4937,13 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.StorageAccountTypes + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type @@ -3843,14 +4953,14 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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: Whether this is a primary NIC on a virtual machine. - :type primary: bool - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetIPConfiguration] """ @@ -3874,6 +4984,17 @@ def __init__( ip_configurations: Optional[List["VirtualMachineScaleSetIPConfiguration"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetIPConfiguration] + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -3883,8 +5004,8 @@ def __init__( class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -3898,6 +5019,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -3907,35 +5033,35 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2016_04_30_preview.models.CachingTypes - :param create_option: Required. Specifies how the virtual machines in the scale set should be + :vartype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :ivar 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 + :vartype create_option: str or ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes - :param os_type: This property allows you to specify the type of the OS that is included in the + :ivar 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.v2016_04_30_preview.models.OperatingSystemTypes - :param image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before + :vartype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :ivar 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.v2016_04_30_preview.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: + :vartype image: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -3965,6 +5091,38 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2016_04_30_preview.models.CachingTypes + :keyword 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". + :paramtype create_option: str or + ~azure.mgmt.compute.v2016_04_30_preview.models.DiskCreateOptionTypes + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2016_04_30_preview.models.OperatingSystemTypes + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -3978,25 +5136,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -4011,16 +5168,16 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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: 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: + :vartype admin_password: str + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2016_04_30_preview.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2016_04_30_preview.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultSecretGroup] + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2016_04_30_preview.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultSecretGroup] """ _attribute_map = { @@ -4045,6 +5202,52 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: + ~azure.mgmt.compute.v2016_04_30_preview.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: + ~azure.mgmt.compute.v2016_04_30_preview.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2016_04_30_preview.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -4085,6 +5288,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -4126,6 +5331,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -4136,12 +5343,12 @@ def __init__( class VirtualMachineScaleSetStorageProfile(msrest.serialization.Model): """Describes a virtual machine scale set storage profile. - :param image_reference: The image reference. - :type image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetOSDisk - :param data_disks: The data disks. - :type data_disks: + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetDataDisk] """ @@ -4159,6 +5366,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2016_04_30_preview.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -4178,20 +5394,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2016_04_30_preview.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2016_04_30_preview.models.Plan + :vartype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] @@ -4203,18 +5419,18 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.DiagnosticsProfile + :ivar 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 @@ -4224,10 +5440,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2016_04_30_preview.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2016_04_30_preview.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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -4235,7 +5451,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -4290,6 +5506,50 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2016_04_30_preview.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: + ~azure.mgmt.compute.v2016_04_30_preview.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2016_04_30_preview.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -4334,6 +5594,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -4342,10 +5604,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -4358,6 +5620,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -4367,8 +5635,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -4385,6 +5653,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -4392,30 +5664,31 @@ def __init__( class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): """The instance view of a virtual machine scale set VM. - :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.v2016_04_30_preview.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineAgentInstanceView + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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: + :vartype boot_diagnostics: ~azure.mgmt.compute.v2016_04_30_preview.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _attribute_map = { @@ -4444,6 +5717,33 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineAgentInstanceView + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2016_04_30_preview.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: + ~azure.mgmt.compute.v2016_04_30_preview.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2016_04_30_preview.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -4461,11 +5761,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4484,6 +5784,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4492,17 +5799,17 @@ def __init__( class VirtualMachineScaleSetVMProfile(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: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetNetworkProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetExtensionProfile """ @@ -4522,6 +5829,20 @@ def __init__( extension_profile: Optional["VirtualMachineScaleSetExtensionProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetNetworkProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetExtensionProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -4532,20 +5853,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -4568,6 +5889,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -4580,8 +5917,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSize] """ _attribute_map = { @@ -4594,6 +5931,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -4623,6 +5964,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -4631,23 +5974,23 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2016_04_30_preview.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2016_04_30_preview.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2016_04_30_preview.models.WinRMConfiguration """ _attribute_map = { @@ -4668,6 +6011,26 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + updates. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2016_04_30_preview.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2016_04_30_preview.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -4679,8 +6042,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2016_04_30_preview.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2016_04_30_preview.models.WinRMListener] """ _attribute_map = { @@ -4693,6 +6056,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2016_04_30_preview.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -4700,18 +6067,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2016_04_30_preview.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2016_04_30_preview.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -4726,6 +6093,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2016_04_30_preview.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py index 579bbd69e59e..0011fab064bc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py @@ -5,23 +5,239 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +261,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.AvailabilitySet" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +287,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySet') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,15 +316,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -135,27 +343,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -171,15 +369,17 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -196,27 +396,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,18 +420,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + **kwargs: Any + ) -> Iterable["_models.AvailabilitySetListResult"]: """Lists all availability sets 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 AvailabilitySetListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -249,34 +443,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -294,24 +483,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2016_04_30_preview.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -319,35 +511,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -365,18 +553,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -385,8 +574,10 @@ def list_available_sizes( :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.v2016_04_30_preview.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -394,36 +585,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -441,6 +629,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py index dd6986097783..683c26b368db 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py @@ -5,25 +5,329 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +353,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +396,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +420,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2016_04_30_preview.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +443,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +469,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +517,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +541,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2016_04_30_preview.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +564,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +590,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +618,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +642,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -420,15 +683,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -439,15 +704,19 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -461,24 +730,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,14 +752,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -512,35 +775,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -558,16 +817,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -580,34 +840,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -625,6 +880,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -632,43 +888,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -684,16 +929,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -707,15 +954,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2016_04_30_preview.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -727,27 +977,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -759,41 +1003,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -809,15 +1043,17 @@ def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -828,15 +1064,19 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -850,24 +1090,17 @@ def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -879,4 +1112,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py index 64a3f6bed091..397e4556ca27 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py @@ -5,25 +5,210 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +234,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +277,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +299,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2016_04_30_preview.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +322,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,41 +348,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -225,15 +388,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -242,15 +407,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,24 +433,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -293,16 +455,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -321,29 +484,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -357,21 +509,24 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2016_04_30_preview.models.ImageListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -379,35 +534,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,22 +576,24 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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.v2016_04_30_preview.models.ImageListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -448,34 +601,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -493,6 +641,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py index eda6b47e4096..a4156d06979c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py @@ -5,25 +5,329 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +353,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +396,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -124,15 +419,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,27 +442,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -176,47 +468,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -234,16 +516,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -255,15 +539,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -275,27 +562,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -307,15 +588,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -333,27 +615,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,41 +639,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,15 +680,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -435,15 +700,19 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,24 +726,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -486,21 +748,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots 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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -508,35 +772,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -554,21 +814,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -576,34 +838,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -621,6 +878,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -628,43 +886,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -680,16 +927,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -702,15 +951,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2016_04_30_preview.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -722,27 +974,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -754,41 +1000,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -804,15 +1040,17 @@ def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -822,15 +1060,19 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -844,24 +1086,17 @@ def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -873,4 +1108,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py index 21feed139234..5a5218ab7fc0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -58,7 +93,8 @@ def list( :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.v2016_04_30_preview.models.ListUsagesResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -66,35 +102,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py index ad6ca394b0fe..a84f55334383 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py index 7a14d0ccca02..bdcc9922bdb3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,197 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +221,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +266,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -126,18 +290,24 @@ def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension + :type extension_parameters: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +320,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +346,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +392,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +415,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +445,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,43 +471,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +513,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -389,15 +535,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,25 +562,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,17 +584,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -473,30 +616,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,4 +642,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py index ec4daf546b61..eb1a7b0ec846 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py index 21ed4eef5590..28de0abbf1ec 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,405 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,39 +429,28 @@ def __init__(self, client, config, serializer, deserializer): def _reimage_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,16 +466,18 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -117,15 +488,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,25 +515,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -170,43 +537,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,16 +579,18 @@ def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -243,15 +602,19 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -266,25 +629,17 @@ def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -296,43 +651,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -348,16 +693,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -370,15 +717,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -393,25 +744,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -423,43 +766,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -475,16 +808,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -495,15 +830,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -518,25 +857,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -548,16 +879,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -576,28 +908,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -611,16 +933,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -639,28 +963,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -674,18 +988,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -699,8 +1015,10 @@ def list( :param expand: The expand expression to apply to 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 VirtualMachineScaleSetVMListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -708,42 +1026,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -761,6 +1076,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -768,39 +1084,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -816,16 +1121,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -838,15 +1145,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -861,25 +1172,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -891,43 +1194,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -943,16 +1236,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -963,15 +1258,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -986,25 +1285,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1016,43 +1307,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1068,16 +1349,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1088,15 +1371,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1111,25 +1398,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1141,4 +1420,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py index 49ec312effc1..5689cdaa4e78 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,610 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +634,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.VirtualMachineScaleSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2016-04-30-preview" - 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("name", 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +677,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.VirtualMachineScaleSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineScaleSet"] + resource_group_name: str, + name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +699,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +724,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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("name", 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,41 +750,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -225,15 +790,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -242,15 +809,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,24 +835,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -293,15 +857,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -318,27 +883,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,50 +907,41 @@ def get( 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -411,16 +957,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -430,18 +978,24 @@ def begin_deallocate( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -453,27 +1007,21 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -485,47 +1033,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -541,16 +1079,18 @@ def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -558,18 +1098,24 @@ def begin_delete_instances( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -581,27 +1127,21 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,15 +1153,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -638,27 +1179,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -672,21 +1203,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2016_04_30_preview.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -694,35 +1229,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -740,23 +1271,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2016_04_30_preview.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -764,34 +1298,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -809,18 +1338,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -829,8 +1359,10 @@ def list_skus( :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.v2016_04_30_preview.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -838,36 +1370,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -885,6 +1414,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -892,46 +1422,35 @@ def get_next(next_link=None): def _power_off_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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -947,16 +1466,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -966,18 +1487,24 @@ def begin_power_off( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -989,27 +1516,21 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1021,50 +1542,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1080,16 +1591,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1097,18 +1610,24 @@ def begin_restart( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1120,27 +1639,21 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1152,50 +1665,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1211,16 +1714,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1228,18 +1733,24 @@ def begin_start( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1251,27 +1762,21 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1283,47 +1788,37 @@ def get_long_running_output(pipeline_response): ) 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 _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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1339,16 +1834,18 @@ def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1356,18 +1853,24 @@ def begin_update_instances( :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1379,27 +1882,21 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1411,41 +1908,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1461,15 +1948,17 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1478,15 +1967,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1500,24 +1993,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1529,41 +2015,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1579,15 +2055,17 @@ def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace def begin_reimage_all( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @@ -1597,15 +2075,19 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1619,24 +2101,17 @@ def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1648,4 +2123,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py index e3c38bf1e70b..5d976b48f56f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,19 +80,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes for a subscription in a location. :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.v2016_04_30_preview.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -65,35 +102,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py index 9844436a9fdf..b1d556fff6cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py @@ -5,25 +5,573 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_extensions_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-04-30-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,14 +595,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_extensions( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -73,29 +621,18 @@ def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,47 +646,38 @@ def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -165,16 +693,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -183,18 +713,24 @@ def begin_capture( :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.v2016_04_30_preview.models.VirtualMachineCaptureParameters + :type parameters: + ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +742,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -238,47 +768,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2016-04-30-preview" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,16 +816,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -316,15 +838,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2016_04_30_preview.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2016_04_30_preview.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -336,27 +863,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,41 +889,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -418,15 +929,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -435,15 +948,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,24 +974,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -486,23 +996,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -514,29 +1026,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,41 +1051,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + def _convert_to_managed_disks_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -600,15 +1092,17 @@ def _convert_to_managed_disks_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -618,15 +1112,19 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -640,24 +1138,17 @@ def begin_convert_to_managed_disks( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,41 +1160,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -719,15 +1200,17 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses. @@ -737,15 +1220,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -759,24 +1246,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -788,15 +1268,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResponse" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.OperationStatusResponse": """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -813,27 +1294,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -847,22 +1318,26 @@ def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2016_04_30_preview.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -870,35 +1345,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -916,22 +1387,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2016_04_30_preview.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -939,34 +1413,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -984,18 +1453,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1004,8 +1474,10 @@ def list_available_sizes( :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.v2016_04_30_preview.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1013,36 +1485,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1060,6 +1529,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1067,37 +1537,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1113,15 +1572,17 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1131,15 +1592,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1153,24 +1618,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1182,41 +1640,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1232,15 +1680,17 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1249,15 +1699,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1271,24 +1725,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1300,41 +1747,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1350,15 +1787,17 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1367,15 +1806,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1389,24 +1832,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1418,41 +1854,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-04-30-preview" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1468,15 +1894,17 @@ def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1485,15 +1913,19 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1507,24 +1939,17 @@ def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1536,4 +1961,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py index d7b3e94880bd..15ace3cb5f83 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py @@ -6,149 +6,136 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, ImagesOperations, ResourceSkusOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import ResourceSkusOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import VirtualMachineRunCommandsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2017_03_30.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2017_03_30.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2017_03_30.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2017_03_30.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2017_03_30.operations.ImagesOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2017_03_30.operations.ResourceSkusOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineScaleSetVMsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2017_03_30.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2017_03_30.operations.SnapshotsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2017_03_30.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2017_03_30.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - 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.resource_skus = ResourceSkusOperations( - 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_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_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(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.resource_skus = ResourceSkusOperations(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_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_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py index 776426f72df5..cc900f349a5c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json index 9f70e9897d99..f9c34aaa1b6d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "availability_sets": "AvailabilitySetsOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py index 7cbe4a37ab00..604f13d25c01 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py @@ -6,145 +6,137 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, ImagesOperations, ResourceSkusOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import ResourceSkusOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import VirtualMachineRunCommandsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2017_03_30.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2017_03_30.aio.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2017_03_30.aio.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2017_03_30.aio.operations.ImagesOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2017_03_30.aio.operations.ResourceSkusOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineScaleSetVMsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2017_03_30.aio.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2017_03_30.aio.operations.SnapshotsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2017_03_30.aio.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(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.resource_skus = ResourceSkusOperations(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_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_vms = VirtualMachineScaleSetVMsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - 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.resource_skus = ResourceSkusOperations( - 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_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_vms = VirtualMachineScaleSetVMsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py index 33874ea79850..0a910c71608e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py index aabec14b18cd..fbdd83d67dff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -129,27 +128,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -165,8 +154,11 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -189,27 +181,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -223,8 +205,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -236,8 +221,10 @@ def list_by_subscription( '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.v2017_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -245,36 +232,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -292,11 +274,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -307,8 +291,10 @@ def list( :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.v2017_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -316,35 +302,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -362,11 +344,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -381,8 +365,10 @@ def list_available_sizes( :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.v2017_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -390,36 +376,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -437,6 +420,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py index 53d43b616076..9ebe2d43b3b4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2017_03_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2017_03_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,8 +380,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -428,15 +401,19 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -450,24 +427,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,8 +449,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -492,7 +464,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -500,35 +473,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -546,11 +515,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -559,7 +530,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -567,34 +539,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,6 +579,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -629,32 +597,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -670,8 +628,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -692,15 +653,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2017_03_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -712,27 +677,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -744,6 +703,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -757,27 +717,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -793,8 +743,11 @@ async def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -811,15 +764,19 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -833,24 +790,17 @@ async def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -862,4 +812,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py index 3b608ecacb72..b69fe6eb850a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2017_03_30.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -182,27 +178,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -218,8 +204,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -234,15 +223,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -256,24 +249,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -285,8 +271,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -312,29 +300,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -348,8 +325,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -361,7 +341,8 @@ def list_by_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.v2017_03_30.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -369,35 +350,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -415,11 +392,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -429,7 +408,8 @@ def list( :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.v2017_03_30.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -437,34 +417,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -482,6 +457,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py index 75c53c92082c..1d837535968b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._resource_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ResourceSkusResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py index f9ad4f34475b..27a4eeb21446 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,8 +382,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -428,15 +403,19 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -450,24 +429,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,8 +451,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -492,7 +466,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -500,35 +475,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -546,11 +517,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -559,7 +532,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -567,34 +541,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,6 +581,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -629,32 +599,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -670,8 +630,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -692,15 +655,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2017_03_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -712,27 +679,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -744,6 +705,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -757,27 +719,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -793,8 +745,11 @@ async def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -811,15 +766,19 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -833,24 +792,17 @@ async def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -862,4 +814,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py index 143ade08c60c..5c5b43ae1cac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2017_03_30.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py index 651348bfea80..4bfeab648365 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py index abf18343c4ec..9960ef4618f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,28 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +339,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +361,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,25 +388,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,8 +410,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -462,30 +442,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -499,4 +468,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py index 2551825ab387..62c2df6cd0e6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py index c707788e7561..49a21b7db76b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2017_03_30.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py index f534dc98031f..5dab570b257f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -192,28 +190,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,8 +217,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -248,15 +239,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,25 +266,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +288,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -331,30 +320,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,8 +346,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -383,8 +364,10 @@ def list( :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.v2017_03_30.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -392,36 +375,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +419,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index d62ec5ab6fa1..1c7f6998a96b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,27 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -89,8 +83,11 @@ async def _cancel_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -105,15 +102,19 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -127,24 +128,17 @@ async def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -156,6 +150,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -169,27 +164,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -205,8 +190,11 @@ async def _start_os_upgrade_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -223,15 +211,19 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,24 +237,17 @@ async def begin_start_os_upgrade( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -274,8 +259,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -298,27 +285,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -332,4 +309,6 @@ async def get_latest( 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/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py index 2e0a1925f728..f7050c704458 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_power_off_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -92,8 +87,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -111,15 +109,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -134,25 +136,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -164,6 +158,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -178,28 +173,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -215,8 +200,11 @@ async def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -235,15 +223,19 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -258,25 +250,17 @@ async def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -288,6 +272,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -302,28 +287,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -339,8 +314,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -360,15 +338,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -383,25 +365,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -413,6 +387,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -427,28 +402,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -464,8 +429,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -483,15 +451,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -506,25 +478,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -536,8 +500,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -563,28 +529,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -598,8 +554,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -625,28 +584,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -660,8 +609,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -687,8 +639,10 @@ def list( '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.v2017_03_30.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -696,42 +650,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -749,6 +700,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -766,28 +718,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -803,8 +745,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -824,15 +769,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -847,25 +796,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -877,6 +818,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -891,28 +833,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -928,8 +860,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -947,15 +882,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -970,25 +909,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1000,6 +931,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1014,28 +946,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1051,8 +973,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1070,15 +995,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1093,25 +1022,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1123,4 +1044,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py index adc3ec746fdb..30f178100e93 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_power_off_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,27 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -342,8 +323,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -358,15 +342,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -380,24 +368,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -409,8 +390,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -433,27 +416,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -467,8 +440,10 @@ async def get( 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, @@ -481,35 +456,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -525,8 +490,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -543,18 +511,24 @@ async def begin_deallocate( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -566,27 +540,21 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -598,6 +566,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -612,32 +581,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -653,8 +612,11 @@ async def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -669,18 +631,24 @@ async def begin_delete_instances( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -692,27 +660,21 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -724,8 +686,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -748,27 +712,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -782,8 +736,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -794,8 +751,10 @@ def list( :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.v2017_03_30.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -803,35 +762,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -849,11 +804,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -863,8 +820,10 @@ def list_all( 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.v2017_03_30.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -872,34 +831,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -917,11 +871,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -936,8 +892,10 @@ def list_skus( :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.v2017_03_30.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -945,36 +903,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -992,6 +947,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1009,35 +965,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1053,8 +999,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1071,18 +1020,24 @@ async def begin_power_off( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1094,27 +1049,21 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1126,6 +1075,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1140,35 +1090,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1184,8 +1124,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1200,18 +1143,24 @@ async def begin_restart( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1223,27 +1172,21 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1255,6 +1198,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1269,35 +1213,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1313,8 +1247,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1329,18 +1266,24 @@ async def begin_start( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1352,27 +1295,21 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1384,6 +1321,7 @@ def get_long_running_output(pipeline_response): ) 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 _update_instances_initial( @@ -1398,32 +1336,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1439,8 +1367,11 @@ async def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1455,18 +1386,24 @@ async def begin_update_instances( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1478,27 +1415,21 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1510,6 +1441,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1524,35 +1456,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1568,8 +1490,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1584,18 +1509,24 @@ async def begin_reimage( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1607,27 +1538,21 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1639,6 +1564,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1653,35 +1579,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1697,8 +1613,11 @@ async def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1714,18 +1633,24 @@ async def begin_reimage_all( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1737,27 +1662,21 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1769,4 +1688,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py index cdc2e2e18d87..bf1ae395b9fe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2017_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py index 5b247ef87ceb..0517ff41943f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_extensions_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_extensions( self, resource_group_name: str, @@ -68,29 +74,18 @@ async def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,8 +99,11 @@ async def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + + @distributed_trace def list_by_location( self, location: str, @@ -116,8 +114,10 @@ def list_by_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.v2017_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -125,35 +125,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -171,6 +167,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -188,32 +185,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,8 +216,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -249,15 +239,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +264,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,6 +290,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -315,32 +305,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -358,8 +338,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -377,15 +360,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -397,27 +385,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +411,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -442,27 +425,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -478,8 +451,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -494,15 +470,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -516,24 +496,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -545,8 +518,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -560,7 +535,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -572,29 +548,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -608,8 +573,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -632,27 +600,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -666,8 +624,10 @@ async def instance_view( 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, @@ -679,27 +639,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -715,8 +665,11 @@ async def _convert_to_managed_disks_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -732,15 +685,19 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -754,24 +711,17 @@ async def begin_convert_to_managed_disks( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -783,6 +733,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -796,27 +747,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -832,8 +773,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -849,15 +793,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -871,24 +819,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -900,8 +841,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -924,27 +867,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -958,8 +891,11 @@ async def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -971,8 +907,10 @@ def list( :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.v2017_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -980,35 +918,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1026,11 +960,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -1039,8 +975,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2017_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1048,34 +986,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1093,11 +1026,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1112,8 +1047,10 @@ def list_available_sizes( :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.v2017_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1121,36 +1058,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1168,6 +1102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1184,27 +1119,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1220,8 +1145,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1237,15 +1165,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1259,24 +1191,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1288,6 +1213,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1301,27 +1227,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1337,8 +1253,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1353,15 +1272,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1375,24 +1298,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1404,6 +1320,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1417,27 +1334,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1453,8 +1360,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1469,15 +1379,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1491,24 +1405,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1520,6 +1427,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1533,27 +1441,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1569,8 +1467,11 @@ async def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1585,15 +1486,19 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1607,24 +1512,17 @@ async def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1636,6 +1534,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1649,27 +1548,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1685,8 +1574,11 @@ async def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1701,15 +1593,19 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1723,24 +1619,17 @@ async def begin_perform_maintenance( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1752,6 +1641,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1766,32 +1656,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1807,8 +1687,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1826,15 +1709,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1846,27 +1734,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1878,4 +1760,5 @@ def get_long_running_output(pipeline_response): ) 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/v2017_03_30/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/__init__.py index dab6905d0c0e..0685ae6245d9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/__init__.py @@ -6,298 +6,152 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import AdditionalUnattendContent - from ._models_py3 import ApiEntityReference - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import AvailabilitySet - from ._models_py3 import AvailabilitySetListResult - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeLongRunningOperationProperties - from ._models_py3 import CreationData - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import Disk - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import EncryptionSettings - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDiskReference - from ._models_py3 import ImageListResult - from ._models_py3 import ImageOSDisk - from ._models_py3 import ImageReference - from ._models_py3 import ImageStorageProfile - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - 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 OSProfile - from ._models_py3 import OperationStatusResponse - from ._models_py3 import Plan - from ._models_py3 import PurchasePlan - from ._models_py3 import Resource - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCapacity - from ._models_py3 import ResourceSkuCosts - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkusResult - from ._models_py3 import ResourceUpdate - 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 Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import UpdateResource - from ._models_py3 import UpgradePolicy - from ._models_py3 import Usage - from ._models_py3 import UsageName - 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - 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 VirtualMachineScaleSetIPConfiguration - from ._models_py3 import VirtualMachineScaleSetIdentity - from ._models_py3 import VirtualMachineScaleSetInstanceView - from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary - 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 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 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - from ._models_py3 import VirtualMachineStatusCodeCount - from ._models_py3 import WinRMConfiguration - from ._models_py3 import WinRMListener - from ._models_py3 import WindowsConfiguration -except (SyntaxError, ImportError): - from ._models import AccessUri # 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 AvailabilitySet # type: ignore - from ._models import AvailabilitySetListResult # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeLongRunningOperationProperties # type: ignore - from ._models import CreationData # type: ignore - from ._models import DataDisk # type: ignore - from ._models import DataDiskImage # type: ignore - from ._models import DiagnosticsProfile # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import EncryptionSettings # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import Image # type: ignore - from ._models import ImageDataDisk # type: ignore - from ._models import ImageDiskReference # 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 InnerError # type: ignore - from ._models import InstanceViewStatus # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 OSProfile # type: ignore - from ._models import OperationStatusResponse # type: ignore - from ._models import Plan # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCapacity # type: ignore - from ._models import ResourceSkuCosts # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkusResult # type: ignore - from ._models import ResourceUpdate # 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 Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import UpdateResource # type: ignore - from ._models import UpgradePolicy # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageName # 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # 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 VirtualMachineScaleSetIPConfiguration # type: ignore - from ._models import VirtualMachineScaleSetIdentity # type: ignore - from ._models import VirtualMachineScaleSetInstanceView # type: ignore - from ._models import VirtualMachineScaleSetInstanceViewStatusesSummary # 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 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 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # type: ignore - from ._models import VirtualMachineStatusCodeCount # type: ignore - from ._models import WinRMConfiguration # type: ignore - from ._models import WinRMListener # type: ignore - from ._models import WindowsConfiguration # type: ignore +from ._models_py3 import AccessUri +from ._models_py3 import AdditionalUnattendContent +from ._models_py3 import ApiEntityReference +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import AvailabilitySet +from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeLongRunningOperationProperties +from ._models_py3 import CreationData +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import Disk +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import EncryptionSettings +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDiskReference +from ._models_py3 import ImageListResult +from ._models_py3 import ImageOSDisk +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +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 OSProfile +from ._models_py3 import OperationStatusResponse +from ._models_py3 import Plan +from ._models_py3 import PurchasePlan +from ._models_py3 import Resource +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCapacity +from ._models_py3 import ResourceSkuCosts +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkusResult +from ._models_py3 import ResourceUpdate +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 Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import UpdateResource +from ._models_py3 import UpgradePolicy +from ._models_py3 import Usage +from ._models_py3 import UsageName +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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +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 VirtualMachineScaleSetIPConfiguration +from ._models_py3 import VirtualMachineScaleSetIdentity +from ._models_py3 import VirtualMachineScaleSetInstanceView +from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary +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 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 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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +from ._models_py3 import VirtualMachineStatusCodeCount +from ._models_py3 import WinRMConfiguration +from ._models_py3 import WinRMListener +from ._models_py3 import WindowsConfiguration + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py index 9319aad87d79..e3a676bc30d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py @@ -6,32 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -42,7 +27,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -52,7 +37,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IMPORT_ENUM = "Import" COPY = "Copy" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -65,7 +50,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -74,7 +59,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -83,21 +68,21 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ GENERALIZED = "Generalized" SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -105,7 +90,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuCapacityScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scale type applicable to the sku. """ @@ -113,21 +98,21 @@ class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, MANUAL = "Manual" NONE = "None" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for restriction. """ QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -136,7 +121,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -144,7 +129,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -152,7 +137,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. """ @@ -160,7 +145,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_LRS = "Standard_LRS" PREMIUM_LRS = "Premium_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -172,14 +157,14 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models.py deleted file mode 100644 index 8ba7eff42f6f..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models.py +++ /dev/null @@ -1,5650 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'properties.output.accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = 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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2017_03_30.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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2017_03_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2017_03_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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. - :type sku: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.SubResource] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, - 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, - 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, - 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - 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.statuses = None - - -class AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2017_03_30.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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux 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(BootDiagnosticsInstanceView, self).__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - - -class ComputeLongRunningOperationProperties(msrest.serialization.Model): - """Compute-specific operation properties, including output. - - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'output': {'key': 'output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) - self.output = kwargs.get('output', None) - - -class CreationData(msrest.serialization.Model): - """Data used when creating a disk. - - All required parameters must be populated in order to send to Azure. - - :param create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy". - :type create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of - the storage account containing the blob to import as a disk. Required only if the blob is in a - different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - """ - - _validation = { - 'create_option': {'required': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - - -class DataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.CachingTypes - :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.v2017_03_30.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.v2017_03_30.models.ManagedDiskParameters - """ - - _validation = { - 'lun': {'required': True}, - 'create_option': {'required': 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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - } - - def __init__( - self, - **kwargs - ): - 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.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - - -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 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.v2017_03_30.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 Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.provisioning_state = None - - -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.v2017_03_30.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.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 DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS". - :type name: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class ResourceUpdate(msrest.serialization.Model): - """The Resource model definition. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - - -class DiskUpdate(ResourceUpdate): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class EncryptionSettings(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettings, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2017_03_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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_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_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_F1", "Standard_F2", "Standard_F4", - "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", - "Standard_F16s", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", - "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_H8", - "Standard_H16", "Standard_H8m", "Standard_H16m", "Standard_H16r", "Standard_H16mr", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s", "Standard_NC6", - "Standard_NC12", "Standard_NC24", "Standard_NC24r", "Standard_NV6", "Standard_NV12", - "Standard_NV24". - :type vm_size: str or ~azure.mgmt.compute.v2017_03_30.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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_03_30.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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}'}, - 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Image, 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 - - -class ImageDataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - 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) - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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.v2017_03_30.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(msrest.serialization.Model): - """Describes an Operating System disk. - - All required parameters must be populated in order to send to Azure. - - :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.v2017_03_30.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes - """ - - _validation = { - 'os_type': {'required': True}, - 'os_state': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_state': {'key': 'osState', 'type': 'str'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageOSDisk, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.os_state = kwargs['os_state'] - 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) - - -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 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. - - :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 - """ - - _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'}, - } - - 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) - - -class ImageStorageProfile(msrest.serialization.Model): - """Describes a storage profile. - - All required parameters must be populated in order to send to Azure. - - :param os_disk: Required. 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.v2017_03_30.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.v2017_03_30.models.ImageDataDisk] - """ - - _validation = { - 'os_disk': {'required': True}, - } - - _attribute_map = { - 'os_disk': {'key': 'osDisk', 'type': 'ImageOSDisk'}, - 'data_disks': {'key': 'dataDisks', 'type': '[ImageDataDisk]'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageStorageProfile, self).__init__(**kwargs) - self.os_disk = kwargs['os_disk'] - self.data_disks = kwargs.get('data_disks', 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 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.v2017_03_30.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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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.v2017_03_30.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.v2017_03_30.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 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.v2017_03_30.models.SshConfiguration - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - } - - 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) - - -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.v2017_03_30.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 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.v2017_03_30.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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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.v2017_03_30.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 OperationStatusResponse(msrest.serialization.Model): - """Operation status response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2017_03_30.models.ApiError - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResponse, self).__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = 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.v2017_03_30.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.v2017_03_30.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.CachingTypes - :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.v2017_03_30.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.v2017_03_30.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'}, - '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.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.v2017_03_30.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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2017_03_30.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.v2017_03_30.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] - """ - - _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]'}, - } - - 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) - - -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 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 ResourceSku(msrest.serialization.Model): - """Describes an available Compute 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 name: The name of SKU. - :vartype name: str - :ivar tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` - Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` - **Basic**. - :vartype tier: str - :ivar size: The Size of the SKU. - :vartype size: str - :ivar family: The Family of this particular SKU. - :vartype family: str - :ivar kind: The Kind of resources that are supported in this SKU. - :vartype kind: str - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2017_03_30.models.ResourceSkuCapacity - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar api_versions: The api versions that support this SKU. - :vartype api_versions: list[str] - :ivar costs: Metadata for retrieving price info. - :vartype costs: list[~azure.mgmt.compute.v2017_03_30.models.ResourceSkuCosts] - :ivar capabilities: A name value pair to describe the capability. - :vartype capabilities: list[~azure.mgmt.compute.v2017_03_30.models.ResourceSkuCapabilities] - :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :vartype restrictions: list[~azure.mgmt.compute.v2017_03_30.models.ResourceSkuRestrictions] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'kind': {'readonly': True}, - 'capacity': {'readonly': True}, - 'locations': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'costs': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'ResourceSkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'costs': {'key': 'costs', 'type': '[ResourceSkuCosts]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None - - -class ResourceSkuCapabilities(msrest.serialization.Model): - """Describes The SKU capabilities object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: An invariant to describe the feature. - :vartype name: str - :ivar value: An invariant if the feature is measured by quantity. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapabilities, self).__init__(**kwargs) - self.name = None - self.value = None - - -class ResourceSkuCapacity(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: The default capacity. - :vartype default: long - :ivar scale_type: The scale type applicable to the sku. Possible values include: "Automatic", - "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.compute.v2017_03_30.models.ResourceSkuCapacityScaleType - """ - - _validation = { - 'minimum': {'readonly': True}, - 'maximum': {'readonly': True}, - 'default': {'readonly': True}, - 'scale_type': {'readonly': True}, - } - - _attribute_map = { - 'minimum': {'key': 'minimum', 'type': 'long'}, - 'maximum': {'key': 'maximum', 'type': 'long'}, - 'default': {'key': 'default', 'type': 'long'}, - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapacity, self).__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None - - -class ResourceSkuCosts(msrest.serialization.Model): - """Describes metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The multiplier is needed to extend the base metered cost. - :vartype quantity: long - :ivar extended_unit: An invariant to show the extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterID', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCosts, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class ResourceSkuRestrictions(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 type: The type of restrictions. The only acceptable values to pass in are None and - "Location". The default value is None. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar reason_code: The reason for restriction. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.compute.v2017_03_30.models.ResourceSkuRestrictionsReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'reason_code': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = None - - -class ResourceSkusResult(msrest.serialization.Model): - """The Compute 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 subscription. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.ResourceSku] - :param next_link: The uri to fetch the next page of Compute 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': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkusResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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 - """ - - _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'}, - } - - 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) - - -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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2017_03_30.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2017_03_30.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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(OperationStatusResponse): - """Run command operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2017_03_30.models.ApiError - :param output: Operation output data (raw JSON). - :type output: any - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - 'output': {'key': 'properties.output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(RunCommandResult, self).__init__(**kwargs) - self.output = kwargs.get('output', None) - - -class Sku(msrest.serialization.Model): - """Describes a virtual machine scale set sku. - - :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. 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. - :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 Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.provisioning_state = None - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotUpdate(ResourceUpdate): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', 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.v2017_03_30.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 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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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 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 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.v2017_03_30.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set - instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'rolling_upgrade_policy': {'key': 'rollingUpgradePolicy', 'type': 'RollingUpgradePolicy'}, - 'automatic_os_upgrade': {'key': 'automaticOSUpgrade', 'type': 'bool'}, - } - - 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 = kwargs.get('automatic_os_upgrade', 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: An enum describing the unit of usage measurement. Has constant 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.v2017_03_30.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 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.v2017_03_30.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', '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'}, - } - - 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.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2017_03_30.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.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 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): - """Resource Id. - - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'output': {'key': 'properties.output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineCaptureResult, self).__init__(**kwargs) - self.output = kwargs.get('output', 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2017_03_30.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'}, - '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.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.v2017_03_30.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.v2017_03_30.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2017_03_30.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. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the virtual machine. - :vartype tenant_id: str - :param type: The type of identity used for the virtual machine. Currently, the only supported - type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to - pass in are None and "SystemAssigned". The default value is None. - :type type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', 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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2017_03_30.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2017_03_30.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2017_03_30.models.DataDiskImage] - """ - - _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}'}, - 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2017_03_30.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2017_03_30.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView] - :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.v2017_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] - """ - - _attribute_map = { - '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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2017_03_30.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 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.v2017_03_30.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.v2017_03_30.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_03_30.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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2017_03_30.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 - :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. - :type single_placement_group: bool - """ - - _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]'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, - } - - 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.upgrade_policy = kwargs.get('upgrade_policy', None) - self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.provisioning_state = None - self.overprovision = kwargs.get('overprovision', None) - self.unique_id = None - self.single_placement_group = kwargs.get('single_placement_group', 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.v2017_03_30.models.CachingTypes - :param create_option: Required. The create option. Possible values include: "FromImage", - "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _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'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, - } - - 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.create_option = kwargs['create_option'] - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', 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 - :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: 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - 'settings': {'key': 'properties.settings', 'type': 'object'}, - 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - 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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provisioning_state = 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.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the virtual machine scale set. - :vartype tenant_id: str - :param type: The type of identity used for the virtual machine scale set. Currently, the only - supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable - values to pass in are None and "SystemAssigned". The default value is None. - :type type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', 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.v2017_03_30.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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 load balancer. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2017_03_30.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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_03_30.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]'}, - '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.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 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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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. Managed - OS disk storage account type can only be set when you create the scale set. Possible values - are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes - """ - - _attribute_map = { - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIPConfiguration] - """ - - _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'}, - 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetIPConfiguration]'}, - } - - 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.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) - - -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.v2017_03_30.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.CachingTypes - :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.v2017_03_30.models.DiskCreateOptionTypes - :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.v2017_03_30.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _validation = { - 'create_option': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'create_option': {'key': 'createOption', 'type': 'str'}, - '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.create_option = kwargs['create_option'] - 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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - """ - - _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'}, - } - - 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) - - -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 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.v2017_03_30.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2017_03_30.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: 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 - """ - - _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'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetUpdateVMProfile'}, - 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, - 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, - } - - 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.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.overprovision = kwargs.get('overprovision', None) - self.single_placement_group = kwargs.get('single_placement_group', None) - - -class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): - """Describes a virtual machine scale set network profile's IP configuration. - - :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.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: - list[~azure.mgmt.compute.v2017_03_30.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2017_03_30.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_03_30.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]'}, - '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.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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateIPConfiguration] - """ - - _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'}, - 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetUpdateIPConfiguration]'}, - } - - 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.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) - - -class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): - """Describes a virtual machine scale set network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) - 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.v2017_03_30.models.CachingTypes - :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.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _attribute_map = { - 'caching': {'key': 'caching', 'type': 'str'}, - '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.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.v2017_03_30.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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.v2017_03_30.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - 'license_type': {'key': 'licenseType', '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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - self.license_type = kwargs.get('license_type', 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.v2017_03_30.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.v2017_03_30.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] - :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2017_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'instance_id': {'readonly': True}, - 'sku': {'readonly': True}, - 'resources': {'readonly': True}, - 'latest_model_applied': {'readonly': True}, - 'vm_id': {'readonly': True}, - 'instance_view': {'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'}, - '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]'}, - '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'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVM, self).__init__(**kwargs) - self.instance_id = None - self.sku = None - self.plan = kwargs.get('plan', None) - self.resources = 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.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', 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) - - -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.v2017_03_30.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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2017_03_30.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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'}, - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2017_03_30.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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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.v2017_03_30.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - 'license_type': {'key': 'licenseType', '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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - self.license_type = kwargs.get('license_type', None) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = 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 virtual machine is enabled for automatic - updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :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.v2017_03_30.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2017_03_30.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2017_03_30.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2017_03_30.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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2017_03_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models_py3.py index 2a88b0945e9d..49ff5bb9326d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,21 +44,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2017_03_30.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2017_03_30.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -75,6 +77,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2017_03_30.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -85,9 +104,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -100,6 +119,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -107,16 +131,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2017_03_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2017_03_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2017_03_30.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2017_03_30.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -137,6 +161,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2017_03_30.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2017_03_30.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -148,12 +184,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -170,6 +206,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -189,10 +233,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -217,6 +261,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -238,18 +288,18 @@ class AvailabilitySet(Resource): :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. - :type sku: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.SubResource] + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2017_03_30.models.SubResource] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] """ @@ -286,6 +336,21 @@ def __init__( virtual_machines: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -299,11 +364,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -322,6 +387,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -330,11 +402,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -349,6 +421,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -379,6 +458,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -387,8 +468,8 @@ def __init__( class ComputeLongRunningOperationProperties(msrest.serialization.Model): """Compute-specific operation properties, including output. - :param output: Operation output data (raw JSON). - :type output: any + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -401,6 +482,10 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) self.output = output @@ -410,21 +495,21 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy". - :type create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of + :vartype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOption + :ivar storage_account_id: If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str """ _validation = { @@ -449,6 +534,23 @@ def __init__( source_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOption + :keyword storage_account_id: If createOption is Import, the Azure Resource Manager identifier + of the storage account containing the blob to import as a disk. Required only if the blob is in + a different subscription. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -462,38 +564,38 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2017_03_30.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :ivar 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.v2017_03_30.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :ivar 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.v2017_03_30.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :ivar 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.v2017_03_30.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :ivar 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.v2017_03_30.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.ManagedDiskParameters """ _validation = { @@ -525,6 +627,40 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.ManagedDiskParameters + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -558,6 +694,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -565,11 +703,11 @@ def __init__( 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 + :ivar 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.v2017_03_30.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2017_03_30.models.BootDiagnostics """ _attribute_map = { @@ -582,6 +720,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2017_03_30.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -599,30 +744,30 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :ivar sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str """ @@ -667,6 +812,28 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -682,13 +849,13 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultSecretReference - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -705,6 +872,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -714,13 +890,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2017_03_30.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2017_03_30.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -737,6 +914,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2017_03_30.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -748,11 +935,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -771,6 +958,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -781,8 +975,8 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS". - :type name: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS". + :vartype name: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -802,6 +996,10 @@ def __init__( name: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -810,10 +1008,10 @@ def __init__( class ResourceUpdate(msrest.serialization.Model): """The Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku """ _attribute_map = { @@ -828,6 +1026,12 @@ def __init__( sku: Optional["DiskSku"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + """ super(ResourceUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -836,19 +1040,19 @@ def __init__( class DiskUpdate(ResourceUpdate): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings """ _attribute_map = { @@ -869,6 +1073,21 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + """ super(DiskUpdate, self).__init__(tags=tags, sku=sku, **kwargs) self.os_type = os_type self.disk_size_gb = disk_size_gb @@ -878,15 +1097,15 @@ def __init__( class EncryptionSettings(msrest.serialization.Model): """Encryption settings for disk or snapshot. - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndKeyReference + :vartype enabled: bool + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :vartype key_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -903,6 +1122,18 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword enabled: Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2017_03_30.models.KeyVaultAndKeyReference + """ super(EncryptionSettings, self).__init__(**kwargs) self.enabled = enabled self.disk_encryption_key = disk_encryption_key @@ -914,10 +1145,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2017_03_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read". + :vartype access: str or ~azure.mgmt.compute.v2017_03_30.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -937,6 +1168,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read". + :paramtype access: str or ~azure.mgmt.compute.v2017_03_30.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -945,7 +1182,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -975,7 +1212,7 @@ class HardwareProfile(msrest.serialization.Model): "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s", "Standard_NC6", "Standard_NC12", "Standard_NC24", "Standard_NC24r", "Standard_NV6", "Standard_NV12", "Standard_NV24". - :type vm_size: str or ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -988,6 +1225,39 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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_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_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_F1", "Standard_F2", "Standard_F4", + "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", + "Standard_F16s", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", + "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_H8", + "Standard_H16", "Standard_H8m", "Standard_H16m", "Standard_H16r", "Standard_H16mr", + "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s", "Standard_NC6", + "Standard_NC12", "Standard_NC24", "Standard_NC24r", "Standard_NV6", "Standard_NV12", + "Standard_NV24". + :paramtype vm_size: str or ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -1005,14 +1275,14 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_03_30.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -1045,6 +1315,16 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.ImageStorageProfile + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1056,30 +1336,31 @@ class ImageDataDisk(msrest.serialization.Model): 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 + :ivar 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype lun: int + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2017_03_30.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :ivar 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. Possible + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes """ _validation = { @@ -1108,6 +1389,33 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + """ super(ImageDataDisk, self).__init__(**kwargs) self.lun = lun self.snapshot = snapshot @@ -1123,12 +1431,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -1147,6 +1455,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -1157,11 +1473,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2017_03_30.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1180,6 +1496,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1190,33 +1513,34 @@ class ImageOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. This property allows you to specify the type of the OS that is + :ivar 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.v2017_03_30.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemStateTypes + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2017_03_30.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :ivar 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. Possible + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes """ _validation = { @@ -1248,6 +1572,37 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemStateTypes + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + """ super(ImageOSDisk, self).__init__(**kwargs) self.os_type = os_type self.os_state = os_state @@ -1262,8 +1617,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1276,6 +1631,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1283,21 +1642,21 @@ def __init__( 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. - :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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -1318,6 +1677,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -1330,16 +1706,16 @@ class ImageStorageProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_disk: Required. Specifies information about the operating system disk used by the + :ivar os_disk: Required. 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.v2017_03_30.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2017_03_30.models.ImageOSDisk + :ivar 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.v2017_03_30.models.ImageDataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.ImageDataDisk] """ _validation = { @@ -1358,6 +1734,18 @@ def __init__( data_disks: Optional[List["ImageDataDisk"]] = None, **kwargs ): + """ + :keyword os_disk: Required. 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2017_03_30.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.ImageDataDisk] + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -1366,10 +1754,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -1384,6 +1772,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -1392,16 +1786,16 @@ def __init__( 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.v2017_03_30.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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2017_03_30.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -1422,6 +1816,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2017_03_30.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -1435,10 +1841,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -1458,6 +1864,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -1468,10 +1880,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -1491,6 +1903,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -1501,10 +1919,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2017_03_30.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SubResource """ _validation = { @@ -1524,6 +1942,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -1534,10 +1958,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2017_03_30.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SubResource """ _validation = { @@ -1557,6 +1981,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -1565,11 +1995,11 @@ def __init__( 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 + :ivar 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.v2017_03_30.models.SshConfiguration + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2017_03_30.models.SshConfiguration """ _attribute_map = { @@ -1584,6 +2014,13 @@ def __init__( ssh: Optional["SshConfiguration"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2017_03_30.models.SshConfiguration + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -1594,11 +2031,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2017_03_30.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1617,6 +2054,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1625,23 +2069,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2017_03_30.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -1666,6 +2110,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2017_03_30.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -1679,12 +2142,13 @@ def __init__( 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. Possible + :ivar id: Resource Id. + :vartype id: str + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes """ _attribute_map = { @@ -1699,6 +2163,15 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type @@ -1706,11 +2179,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -1725,6 +2198,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -1732,9 +2212,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2017_03_30.models.NetworkInterfaceReference] """ @@ -1748,6 +2228,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2017_03_30.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -1789,6 +2275,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusResponse, self).__init__(**kwargs) self.name = None self.status = None @@ -1802,42 +2290,42 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2017_03_30.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :ivar 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.v2017_03_30.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :ivar 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.v2017_03_30.models.CachingTypes - :param create_option: Required. Specifies how the virtual machine should be + :vartype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :ivar 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.v2017_03_30.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :ivar 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.v2017_03_30.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.ManagedDiskParameters """ _validation = { @@ -1870,6 +2358,44 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -1887,9 +2413,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes """ _validation = { @@ -1906,6 +2432,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -1913,29 +2444,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -1950,27 +2480,26 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration + :ivar 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.v2017_03_30.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] """ _attribute_map = { @@ -1995,6 +2524,66 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -2008,15 +2597,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -2035,6 +2624,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -2047,13 +2647,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -2076,6 +2676,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -2150,6 +2759,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -2190,6 +2801,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = None self.value = None @@ -2229,6 +2842,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -2265,6 +2880,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCosts, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -2304,6 +2921,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = None self.values = None @@ -2315,11 +2934,11 @@ class ResourceSkusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.ResourceSku] - :param next_link: The uri to fetch the next page of Compute Skus. Call ListNext() with this to + :ivar value: Required. The list of skus available for the subscription. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.ResourceSku] + :ivar next_link: The uri to fetch the next page of Compute Skus. Call ListNext() with this to fetch the next page of VMSS Skus. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2338,6 +2957,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the subscription. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.ResourceSku] + :keyword next_link: The uri to fetch the next page of Compute Skus. Call ListNext() with this + to fetch the next page of VMSS Skus. + :paramtype next_link: str + """ super(ResourceSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2346,26 +2972,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -2390,6 +3016,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -2431,6 +3079,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -2473,6 +3123,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -2493,10 +3145,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2017_03_30.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -2538,6 +3190,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -2550,17 +3208,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param label: Required. The VM run command label. - :type label: str - :param description: Required. The VM run command description. - :type description: str + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -2589,6 +3247,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -2602,21 +3273,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2017_03_30.models.RunCommandParameterDefinition] """ _validation = { @@ -2650,6 +3321,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2017_03_30.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -2660,13 +3349,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2017_03_30.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2017_03_30.models.RunCommandInputParameter] """ _validation = { @@ -2687,6 +3376,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2017_03_30.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -2698,10 +3396,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -2721,6 +3419,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -2731,11 +3435,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2017_03_30.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2754,6 +3458,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2764,14 +3475,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -2795,6 +3506,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -2817,8 +3538,8 @@ class RunCommandResult(OperationStatusResponse): :vartype end_time: ~datetime.datetime :ivar error: Api error. :vartype error: ~azure.mgmt.compute.v2017_03_30.models.ApiError - :param output: Operation output data (raw JSON). - :type output: any + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _validation = { @@ -2844,6 +3565,10 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(RunCommandResult, self).__init__(**kwargs) self.output = output @@ -2851,16 +3576,16 @@ def __init__( class Sku(msrest.serialization.Model): """Describes a virtual machine scale set sku. - :param name: The sku name. - :type name: str - :param tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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. NOTE: If the new VM + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. 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. - :type capacity: long + :vartype capacity: long """ _attribute_map = { @@ -2877,6 +3602,18 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. 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. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2896,28 +3633,28 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :ivar sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str """ @@ -2960,6 +3697,26 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2017_03_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -2976,11 +3733,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2999,6 +3756,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3007,19 +3771,19 @@ def __init__( class SnapshotUpdate(ResourceUpdate): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. - :type sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings """ _attribute_map = { @@ -3040,6 +3804,21 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings + """ super(SnapshotUpdate, self).__init__(tags=tags, sku=sku, **kwargs) self.os_type = os_type self.disk_size_gb = disk_size_gb @@ -3049,8 +3828,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -3063,6 +3842,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -3070,8 +3853,8 @@ def __init__( 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.v2017_03_30.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2017_03_30.models.SshPublicKey] """ _attribute_map = { @@ -3084,6 +3867,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2017_03_30.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -3091,15 +3878,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -3114,6 +3901,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -3122,21 +3920,21 @@ def __init__( 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 + :ivar 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.v2017_03_30.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageReference + :ivar 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.v2017_03_30.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2017_03_30.models.OSDisk + :ivar 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.v2017_03_30.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.DataDisk] """ _attribute_map = { @@ -3153,6 +3951,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2017_03_30.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -3180,6 +3995,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -3187,8 +4004,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -3201,6 +4018,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -3208,19 +4029,19 @@ def __init__( 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.v2017_03_30.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2017_03_30.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.RollingUpgradePolicy + :ivar automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool + :vartype automatic_os_upgrade: bool """ _attribute_map = { @@ -3237,6 +4058,21 @@ def __init__( automatic_os_upgrade: Optional[bool] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2017_03_30.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.RollingUpgradePolicy + :keyword automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + instances in a rolling fashion when a newer version of the image becomes available. + :paramtype automatic_os_upgrade: bool + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -3252,12 +4088,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2017_03_30.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2017_03_30.models.UsageName """ _validation = { @@ -3284,6 +4120,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2017_03_30.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -3293,10 +4137,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -3311,6 +4155,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -3319,21 +4169,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -3348,6 +4198,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -3356,12 +4223,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2017_03_30.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2017_03_30.models.VaultCertificate] """ _attribute_map = { @@ -3376,6 +4243,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2017_03_30.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -3384,8 +4259,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -3398,6 +4273,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -3415,34 +4294,34 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2017_03_30.models.Plan + :vartype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2017_03_30.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :ivar 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 @@ -3452,12 +4331,12 @@ class VirtualMachine(Resource): `_ :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.v2017_03_30.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2017_03_30.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.v2017_03_30.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -3465,7 +4344,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -3521,6 +4400,53 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2017_03_30.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -3541,13 +4467,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -3564,6 +4490,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -3575,13 +4510,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -3604,6 +4539,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -3613,10 +4557,10 @@ def __init__( class VirtualMachineCaptureResult(SubResource): """Resource Id. - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any + :ivar id: Resource Id. + :vartype id: str + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -3631,6 +4575,12 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.output = output @@ -3648,33 +4598,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2017_03_30.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -3717,6 +4668,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -3732,12 +4711,12 @@ def __init__( 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.v2017_03_30.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus """ _attribute_map = { @@ -3754,6 +4733,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -3773,23 +4760,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -3824,6 +4811,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -3835,16 +4841,16 @@ def __init__( 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.v2017_03_30.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -3865,6 +4871,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -3876,8 +4894,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] """ _attribute_map = { @@ -3890,6 +4908,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -3897,26 +4919,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -3943,6 +4965,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -3974,6 +5018,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -3987,10 +5033,10 @@ class VirtualMachineIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant id associated with the virtual machine. :vartype tenant_id: str - :param type: The type of identity used for the virtual machine. Currently, the only supported + :ivar type: The type of identity used for the virtual machine. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -4010,6 +5056,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of identity used for the virtual machine. Currently, the only supported + type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to + pass in are None and "SystemAssigned". The default value is None. + :paramtype type: str + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -4021,16 +5073,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -4054,6 +5106,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -4065,23 +5129,23 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2017_03_30.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2017_03_30.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2017_03_30.models.DataDiskImage] + :vartype plan: ~azure.mgmt.compute.v2017_03_30.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2017_03_30.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2017_03_30.models.DataDiskImage] """ _validation = { @@ -4111,6 +5175,25 @@ def __init__( data_disk_images: Optional[List["DataDiskImage"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2017_03_30.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2017_03_30.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2017_03_30.models.DataDiskImage] + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -4120,29 +5203,29 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2017_03_30.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2017_03_30.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2017_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2017_03_30.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] """ _attribute_map = { @@ -4171,6 +5254,31 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2017_03_30.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2017_03_30.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -4188,11 +5296,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2017_03_30.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4211,6 +5319,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4229,38 +5344,37 @@ class VirtualMachineScaleSet(Resource): :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.v2017_03_30.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.Sku + :ivar 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.v2017_03_30.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_03_30.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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2017_03_30.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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: 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, + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool + :vartype single_placement_group: bool """ _validation = { @@ -4305,6 +5419,36 @@ def __init__( single_placement_group: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -4323,27 +5467,27 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2017_03_30.models.CachingTypes - :param create_option: Required. The create option. Possible values include: "FromImage", + :vartype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -4372,6 +5516,30 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -4388,26 +5556,26 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: str - :param force_update_tag: If a value is provided and is different from the previous value, the + :ivar name: The name of the extension. + :vartype name: str + :ivar 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: 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str """ @@ -4443,6 +5611,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.force_update_tag = force_update_tag @@ -4460,11 +5650,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2017_03_30.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4483,6 +5673,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4491,8 +5688,9 @@ def __init__( 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.v2017_03_30.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -4505,6 +5703,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -4518,10 +5721,10 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant id associated with the virtual machine scale set. :vartype tenant_id: str - :param type: The type of identity used for the virtual machine scale set. Currently, the only + :ivar type: The type of identity used for the virtual machine scale set. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -4541,6 +5744,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of identity used for the virtual machine scale set. Currently, the only + supported type is 'SystemAssigned', which implicitly creates an identity. The only acceptable + values to pass in are None and "SystemAssigned". The default value is None. + :paramtype type: str + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -4558,8 +5767,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] """ _validation = { @@ -4579,6 +5788,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -4607,6 +5820,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -4616,36 +5831,37 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2017_03_30.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2017_03_30.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2017_03_30.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2017_03_30.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :ivar 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 load balancer. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + :ivar 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 load balancer. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_03_30.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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_03_30.models.SubResource] """ _validation = { @@ -4678,6 +5894,39 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2017_03_30.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -4694,11 +5943,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2017_03_30.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4717,6 +5966,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4727,11 +5983,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2017_03_30.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4750,6 +6006,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4760,11 +6023,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2017_03_30.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4783,6 +6046,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4791,10 +6061,11 @@ def __init__( 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. Managed - OS disk storage account type can only be set when you create the scale set. Possible values - are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + :ivar storage_account_type: 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. Possible values are: + Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes """ _attribute_map = { @@ -4807,6 +6078,13 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values + are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_03_30.models.StorageAccountTypes + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type @@ -4816,23 +6094,23 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIPConfiguration] """ @@ -4862,6 +6140,26 @@ def __init__( ip_configurations: Optional[List["VirtualMachineScaleSetIPConfiguration"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIPConfiguration] + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -4874,8 +6172,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -4888,6 +6186,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -4895,12 +6197,12 @@ def __init__( 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 + :ivar 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.v2017_03_30.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -4916,6 +6218,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -4926,33 +6237,33 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2017_03_30.models.CachingTypes - :param create_option: Required. Specifies how the virtual machines in the scale set should be + :vartype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :ivar 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.v2017_03_30.models.DiskCreateOptionTypes - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :ivar 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.v2017_03_30.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -4982,6 +6293,36 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_03_30.models.DiskCreateOptionTypes + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_03_30.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -4995,25 +6336,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -5028,27 +6368,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration + :ivar 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.v2017_03_30.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.v2017_03_30.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] """ _attribute_map = { @@ -5073,6 +6413,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -5088,12 +6484,12 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -5115,6 +6511,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -5126,10 +6531,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -5146,6 +6551,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -5179,6 +6590,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -5220,6 +6633,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -5230,21 +6645,22 @@ def __init__( 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 + :ivar 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.v2017_03_30.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageReference + :ivar 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.v2017_03_30.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2017_03_30.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -5261,6 +6677,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5270,27 +6704,26 @@ def __init__( 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.v2017_03_30.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2017_03_30.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2017_03_30.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: bool - :param single_placement_group: When true this limits the scale set to a single placement group, + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype single_placement_group: bool """ _attribute_map = { @@ -5317,6 +6750,29 @@ def __init__( single_placement_group: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2017_03_30.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2017_03_30.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype single_placement_group: bool + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -5330,31 +6786,31 @@ def __init__( class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): """Describes a virtual machine scale set network profile's IP configuration. - :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.v2017_03_30.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2017_03_30.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2017_03_30.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.v2017_03_30.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_03_30.models.SubResource] - :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_03_30.models.SubResource] """ _attribute_map = { @@ -5383,6 +6839,34 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2017_03_30.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2017_03_30.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -5397,22 +6881,22 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateIPConfiguration] """ @@ -5438,6 +6922,25 @@ def __init__( ip_configurations: Optional[List["VirtualMachineScaleSetUpdateIPConfiguration"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateIPConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -5450,8 +6953,8 @@ def __init__( class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -5465,6 +6968,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -5472,16 +6980,16 @@ def __init__( 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.v2017_03_30.models.CachingTypes - :param image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :ivar 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.v2017_03_30.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: + :vartype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -5501,6 +7009,19 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2017_03_30.models.CachingTypes + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2017_03_30.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.image = image @@ -5511,14 +7032,14 @@ def __init__( 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.v2017_03_30.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] """ _attribute_map = { @@ -5537,6 +7058,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2017_03_30.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -5547,12 +7078,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -5570,6 +7101,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -5579,12 +7119,13 @@ def __init__( 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.v2017_03_30.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -5601,6 +7142,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2017_03_30.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5610,21 +7160,22 @@ def __init__( 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.v2017_03_30.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str """ _attribute_map = { @@ -5647,6 +7198,24 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -5669,20 +7238,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2017_03_30.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2017_03_30.models.Plan + :vartype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual @@ -5693,18 +7262,18 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2017_03_30.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2017_03_30.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :ivar 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 @@ -5714,10 +7283,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2017_03_30.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2017_03_30.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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -5725,7 +7294,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -5780,6 +7349,49 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2017_03_30.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2017_03_30.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2017_03_30.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2017_03_30.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2017_03_30.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -5824,6 +7436,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -5832,10 +7446,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -5848,6 +7462,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -5857,8 +7477,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -5875,6 +7495,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -5884,31 +7508,31 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2017_03_30.models.VirtualMachineAgentInstanceView - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineAgentInstanceView + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2017_03_30.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2017_03_30.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -5942,6 +7566,31 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineAgentInstanceView + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2017_03_30.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2017_03_30.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -5960,11 +7609,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5983,6 +7632,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5991,24 +7647,24 @@ def __init__( 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.v2017_03_30.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6016,7 +7672,7 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _attribute_map = { @@ -6039,6 +7695,34 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_03_30.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -6051,20 +7735,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -6087,6 +7771,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -6099,8 +7799,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSize] """ _attribute_map = { @@ -6113,6 +7813,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -6142,6 +7846,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -6150,23 +7856,23 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2017_03_30.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2017_03_30.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2017_03_30.models.WinRMConfiguration """ _attribute_map = { @@ -6187,6 +7893,26 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + updates. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2017_03_30.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2017_03_30.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -6198,8 +7924,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2017_03_30.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2017_03_30.models.WinRMListener] """ _attribute_map = { @@ -6212,6 +7938,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2017_03_30.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -6219,18 +7949,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2017_03_30.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2017_03_30.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -6245,6 +7975,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2017_03_30.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py index 75b778a05310..3a496c5bed48 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py @@ -5,23 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +265,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +291,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySet') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,15 +320,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -135,27 +347,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -171,15 +373,17 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -196,27 +400,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,22 +424,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2017_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -253,36 +451,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -300,24 +493,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2017_03_30.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -325,35 +521,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -371,18 +563,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -391,8 +584,10 @@ def list_available_sizes( :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.v2017_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -400,36 +595,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -447,6 +639,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py index c40e73070eb0..d7b700f46ca2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py @@ -5,25 +5,329 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +353,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +396,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +420,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2017_03_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +443,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +469,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +517,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +541,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2017_03_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +564,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +590,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +618,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +642,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -420,15 +683,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -439,15 +704,19 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -461,24 +730,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,14 +752,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -512,35 +775,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -558,16 +817,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -580,34 +840,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -625,6 +880,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -632,43 +888,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -684,16 +929,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -707,15 +954,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2017_03_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -727,27 +977,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -759,41 +1003,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -809,15 +1043,17 @@ def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -828,15 +1064,19 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -850,24 +1090,17 @@ def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -879,4 +1112,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py index c55193f52eac..b9e8ea3986ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py @@ -5,25 +5,210 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +234,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +277,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +299,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2017_03_30.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +322,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,41 +348,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -225,15 +388,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -242,15 +407,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,24 +433,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -293,16 +455,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -321,29 +484,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -357,14 +509,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -379,35 +533,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,16 +575,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -448,34 +599,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -493,6 +639,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py index f64b9974fa9d..a1d0e0718ab7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py @@ -5,23 +5,56 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ResourceSkusOperations(object): """ResourceSkusOperations operations. @@ -45,11 +78,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkusResult"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkusResult"]: """Gets the list of Microsoft.Compute SKUs available for your Subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +95,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +135,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py index 32e79e9a5f85..ab9825a0d761 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py @@ -5,25 +5,329 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +353,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +396,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +420,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +443,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +469,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +517,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +541,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2017_03_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +564,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +590,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +618,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +642,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -420,15 +683,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -439,15 +704,19 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -461,24 +730,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,14 +752,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -512,35 +775,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -558,16 +817,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -580,34 +840,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -625,6 +880,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -632,43 +888,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -684,16 +929,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -707,15 +954,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2017_03_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -727,27 +977,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -759,41 +1003,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -809,15 +1043,17 @@ def _revoke_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -828,15 +1064,19 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -850,24 +1090,17 @@ def begin_revoke_access( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -879,4 +1112,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py index 170601baca2b..9a56359f5766 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py index 2545028db008..5d12b021f0bd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2017_03_30/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extensions_operations.py index 6c0c7fc47ba8..8d88002e11ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,197 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +221,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +266,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +293,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +319,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +345,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +391,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +414,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +444,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,43 +470,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +512,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -389,15 +534,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,25 +561,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,17 +583,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -473,30 +615,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,4 +641,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py index 13fc8d10fbf5..49bc127cd63e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2017_03_30/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_run_commands_operations.py index 469092fcf5dc..323fe24a572d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2017_03_30.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py index bb063d501939..e4c8b06ef426 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,187 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +211,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +256,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +280,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +310,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,43 +336,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - vmss_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,16 +378,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -256,15 +400,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,25 +427,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,17 +449,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -340,30 +481,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,15 +507,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -393,8 +525,10 @@ def list( :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.v2017_03_30.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -402,36 +536,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -449,6 +580,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 985735c66a55..658fc8d20101 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,131 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,37 +155,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,15 +190,17 @@ def _cancel_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -111,15 +209,19 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,24 +235,17 @@ def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -162,41 +257,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,15 +297,17 @@ def _start_os_upgrade_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -231,15 +318,19 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -253,24 +344,17 @@ def begin_start_os_upgrade( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -282,15 +366,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -307,27 +392,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -341,4 +416,6 @@ def get_latest( 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/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py index eb0dab0d440f..ac2cf9cc2891 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,405 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,39 +429,28 @@ def __init__(self, client, config, serializer, deserializer): def _reimage_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,16 +466,18 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -117,15 +488,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,25 +515,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -170,43 +537,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,16 +579,18 @@ def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -243,15 +602,19 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -266,25 +629,17 @@ def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -296,43 +651,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -348,16 +693,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -370,15 +717,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -393,25 +744,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -423,43 +766,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -475,16 +808,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -495,15 +830,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -518,25 +857,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -548,16 +879,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -576,28 +908,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -611,16 +933,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -639,28 +963,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -674,18 +988,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -702,8 +1018,10 @@ def list( '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.v2017_03_30.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -711,42 +1029,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -764,6 +1079,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -771,39 +1087,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -819,16 +1124,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -841,15 +1148,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -864,25 +1175,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -894,43 +1197,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -946,16 +1239,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -966,15 +1261,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -989,25 +1288,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1019,43 +1310,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1071,16 +1352,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1091,15 +1374,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1114,25 +1401,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1144,4 +1423,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py index 6116b8c64e93..af8937d850a1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,672 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +696,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +739,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +761,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +786,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +812,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +856,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +878,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +903,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,41 +929,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,15 +969,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -368,15 +988,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -390,24 +1014,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -419,15 +1036,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -444,27 +1062,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -478,50 +1086,41 @@ def get( 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -537,16 +1136,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -556,18 +1157,24 @@ def begin_deallocate( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -579,27 +1186,21 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -611,47 +1212,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -667,16 +1258,18 @@ def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -684,18 +1277,24 @@ def begin_delete_instances( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -707,27 +1306,21 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -739,15 +1332,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -764,27 +1358,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -798,21 +1382,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2017_03_30.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -820,35 +1408,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -866,23 +1450,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2017_03_30.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -890,34 +1477,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -935,18 +1517,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -955,8 +1538,10 @@ def list_skus( :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.v2017_03_30.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -964,36 +1549,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1011,6 +1593,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1018,46 +1601,35 @@ def get_next(next_link=None): def _power_off_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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1073,16 +1645,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1092,18 +1666,24 @@ def begin_power_off( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1115,27 +1695,21 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1147,50 +1721,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1206,16 +1770,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1223,18 +1789,24 @@ def begin_restart( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1246,27 +1818,21 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1278,50 +1844,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1337,16 +1893,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1354,18 +1912,24 @@ def begin_start( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1377,27 +1941,21 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1409,47 +1967,37 @@ def get_long_running_output(pipeline_response): ) 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 _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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1465,16 +2013,18 @@ def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1482,18 +2032,24 @@ def begin_update_instances( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1505,27 +2061,21 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1537,50 +2087,40 @@ def get_long_running_output(pipeline_response): ) 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_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1596,16 +2136,18 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1613,18 +2155,24 @@ def begin_reimage( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1636,27 +2184,21 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1668,50 +2210,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1727,16 +2259,18 @@ def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @@ -1745,18 +2279,24 @@ def begin_reimage_all( :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1768,27 +2308,21 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1800,4 +2334,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py index 6b5d2f7ab30f..8f0b16152f67 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,19 +80,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes for a subscription in a location. :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.v2017_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -65,35 +102,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py index e7bd9e7211db..575000f596b0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py @@ -5,25 +5,720 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_extensions_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-30" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,14 +742,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_extensions( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -73,29 +768,18 @@ def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,21 +793,25 @@ def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2017_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -131,35 +819,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -177,6 +861,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -184,43 +869,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -236,16 +910,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -257,15 +933,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_03_30.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +958,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,47 +984,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -367,16 +1032,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -387,15 +1054,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2017_03_30.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -407,27 +1078,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,41 +1104,31 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -489,15 +1144,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -506,15 +1163,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -528,24 +1189,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -557,23 +1211,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -585,29 +1241,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -621,15 +1266,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -646,27 +1293,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -680,41 +1317,32 @@ def instance_view( 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -730,15 +1358,17 @@ def _convert_to_managed_disks_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -748,15 +1378,19 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -770,24 +1404,17 @@ def begin_convert_to_managed_disks( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -799,41 +1426,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -849,15 +1466,17 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses. @@ -867,15 +1486,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -889,24 +1512,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -918,15 +1534,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResponse" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.OperationStatusResponse": """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -943,27 +1560,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -977,22 +1584,26 @@ def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2017_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1000,35 +1611,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1046,22 +1653,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2017_03_30.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1069,34 +1679,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1114,18 +1719,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1134,8 +1740,10 @@ def list_available_sizes( :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.v2017_03_30.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1143,36 +1751,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1190,6 +1795,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1197,37 +1803,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1243,15 +1838,17 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1261,15 +1858,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1283,24 +1884,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1312,41 +1906,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1362,15 +1946,17 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1379,15 +1965,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1401,24 +1991,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1430,41 +2013,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1480,15 +2053,17 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1497,15 +2072,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1519,24 +2098,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1548,41 +2120,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1598,15 +2160,17 @@ def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1615,15 +2179,19 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1637,24 +2205,17 @@ def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1666,41 +2227,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-30" - accept = "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'), - '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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1716,15 +2267,17 @@ def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -1733,15 +2286,19 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1755,24 +2312,17 @@ def begin_perform_maintenance( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1784,47 +2334,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2017-03-30" - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1840,16 +2380,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -1860,15 +2402,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2017_03_30.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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2017_03_30.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1880,27 +2426,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1912,4 +2452,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py index 216752437533..f4d4c04f95d6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py @@ -6,73 +6,77 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - +from . import models from ._configuration import ComputeManagementClientConfiguration from .operations import ResourceSkusOperations -from . import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2017_09_01.operations.ResourceSkusOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_skus = ResourceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py index 005dd7336ab9..dff37dad0a4d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json index d60968d0412f..569dfc47a9c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "resource_skus": "ResourceSkusOperations" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py index da7842a7533d..9b21baaf164a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py @@ -6,69 +6,77 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - +from .. import models from ._configuration import ComputeManagementClientConfiguration from .operations import ResourceSkusOperations -from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2017_09_01.aio.operations.ResourceSkusOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_skus = ResourceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py index c312667f78d5..eacf3261d083 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py index 8158d4b0dc08..14c1d8187fa0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._resource_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_09_01.models.ResourceSkusResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_09_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-09-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/__init__.py index 857ab2e97cd5..8bbfb0f84192 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/__init__.py @@ -6,24 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCapacity - from ._models_py3 import ResourceSkuCosts - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkusResult -except (SyntaxError, ImportError): - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCapacity # type: ignore - from ._models import ResourceSkuCosts # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkusResult # type: ignore +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCapacity +from ._models_py3 import ResourceSkuCosts +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkusResult + from ._compute_management_client_enums import ( ResourceSkuCapacityScaleType, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_compute_management_client_enums.py index 7675dc0dd449..d85caa49fe4f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuCapacityScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scale type applicable to the sku. """ @@ -34,14 +19,14 @@ class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, MANUAL = "Manual" NONE = "None" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for restriction. """ QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of restrictions. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models.py deleted file mode 100644 index f6ab7370f26a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models.py +++ /dev/null @@ -1,337 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ResourceSku(msrest.serialization.Model): - """Describes an available Compute 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 name: The name of SKU. - :vartype name: str - :ivar tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` - Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` - **Basic**. - :vartype tier: str - :ivar size: The Size of the SKU. - :vartype size: str - :ivar family: The Family of this particular SKU. - :vartype family: str - :ivar kind: The Kind of resources that are supported in this SKU. - :vartype kind: str - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2017_09_01.models.ResourceSkuCapacity - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: A list of locations and availability zones in those locations where the - SKU is available. - :vartype location_info: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSkuLocationInfo] - :ivar api_versions: The api versions that support this SKU. - :vartype api_versions: list[str] - :ivar costs: Metadata for retrieving price info. - :vartype costs: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSkuCosts] - :ivar capabilities: A name value pair to describe the capability. - :vartype capabilities: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSkuCapabilities] - :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :vartype restrictions: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSkuRestrictions] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'kind': {'readonly': True}, - 'capacity': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'costs': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'ResourceSkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'costs': {'key': 'costs', 'type': '[ResourceSkuCosts]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.location_info = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None - - -class ResourceSkuCapabilities(msrest.serialization.Model): - """Describes The SKU capabilities object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: An invariant to describe the feature. - :vartype name: str - :ivar value: An invariant if the feature is measured by quantity. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapabilities, self).__init__(**kwargs) - self.name = None - self.value = None - - -class ResourceSkuCapacity(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: The default capacity. - :vartype default: long - :ivar scale_type: The scale type applicable to the sku. Possible values include: "Automatic", - "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.compute.v2017_09_01.models.ResourceSkuCapacityScaleType - """ - - _validation = { - 'minimum': {'readonly': True}, - 'maximum': {'readonly': True}, - 'default': {'readonly': True}, - 'scale_type': {'readonly': True}, - } - - _attribute_map = { - 'minimum': {'key': 'minimum', 'type': 'long'}, - 'maximum': {'key': 'maximum', 'type': 'long'}, - 'default': {'key': 'default', 'type': 'long'}, - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapacity, self).__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None - - -class ResourceSkuCosts(msrest.serialization.Model): - """Describes metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The multiplier is needed to extend the base metered cost. - :vartype quantity: long - :ivar extended_unit: An invariant to show the extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterID', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCosts, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """ResourceSkuLocationInfo. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of the SKU. - :vartype location: str - :ivar zones: List of availability zones where the SKU is supported. - :vartype zones: list[str] - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - - -class ResourceSkuRestrictionInfo(msrest.serialization.Model): - """ResourceSkuRestrictionInfo. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar locations: Locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: List of availability zones where the SKU is restricted. - :vartype zones: list[str] - """ - - _validation = { - 'locations': {'readonly': True}, - 'zones': {'readonly': True}, - } - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = None - self.zones = None - - -class ResourceSkuRestrictions(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 type: The type of restrictions. Possible values include: "Location", "Zone". - :vartype type: str or ~azure.mgmt.compute.v2017_09_01.models.ResourceSkuRestrictionsType - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: The information about the restriction where the SKU cannot be used. - :vartype restriction_info: ~azure.mgmt.compute.v2017_09_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: The reason for restriction. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.compute.v2017_09_01.models.ResourceSkuRestrictionsReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'restriction_info': {'readonly': True}, - 'reason_code': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None - - -class ResourceSkusResult(msrest.serialization.Model): - """The List Resource 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 subscription. - :type value: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSku] - :param next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this - URI to fetch the next page of Resource Skus. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkusResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py index af86b15f1004..2026b224642f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py @@ -84,6 +84,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -125,6 +127,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = None self.value = None @@ -164,6 +168,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -200,6 +206,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCosts, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -231,6 +239,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -261,6 +271,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -302,6 +314,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = None self.values = None @@ -314,11 +328,11 @@ class ResourceSkusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSku] - :param next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this - URI to fetch the next page of Resource Skus. - :type next_link: str + :ivar value: Required. The list of skus available for the subscription. + :vartype value: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSku] + :ivar next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI + to fetch the next page of Resource Skus. + :vartype next_link: str """ _validation = { @@ -337,6 +351,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the subscription. + :paramtype value: list[~azure.mgmt.compute.v2017_09_01.models.ResourceSku] + :keyword next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this + URI to fetch the next page of Resource Skus. + :paramtype next_link: str + """ super(ResourceSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py index 9207d310c366..0ae9d6663016 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py @@ -5,23 +5,56 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ResourceSkusOperations(object): """ResourceSkusOperations operations. @@ -45,11 +78,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkusResult"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkusResult"]: """Gets the list of Microsoft.Compute SKUs available for your Subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +95,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-09-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +135,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py index 3b6d6f455535..f10a207f43d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py @@ -6,144 +6,133 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, ImagesOperations, LogAnalyticsOperations, Operations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2017_12_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2017_12_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2017_12_01.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2017_12_01.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2017_12_01.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2017_12_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2017_12_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2017_12_01.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2017_12_01.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - 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_sets = VirtualMachineScaleSetsOperations( - 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_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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(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_sets = VirtualMachineScaleSetsOperations(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_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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py index e8e968ab4248..bee35a9c13f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json index 529cdb3420c2..f89b8664b59e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py index 0a0a683358cf..ad9f599c2336 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py @@ -6,140 +6,134 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, ImagesOperations, LogAnalyticsOperations, Operations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2017_12_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2017_12_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2017_12_01.aio.operations.AvailabilitySetsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2017_12_01.aio.operations.UsageOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2017_12_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2017_12_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2017_12_01.aio.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.availability_sets = AvailabilitySetsOperations(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_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(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_sets = VirtualMachineScaleSetsOperations(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_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.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.availability_sets = AvailabilitySetsOperations( - 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_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_images = VirtualMachineImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - 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_sets = VirtualMachineScaleSetsOperations( - 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_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) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py index 9c045c2eaa83..294ade60f400 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py index 23bec3c81164..dfeec6d99aae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,27 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +213,11 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -255,27 +240,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -289,8 +264,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -302,8 +280,10 @@ def list_by_subscription( '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.v2017_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -311,36 +291,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -358,11 +333,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -373,8 +350,10 @@ def list( :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.v2017_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -382,35 +361,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -428,11 +403,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -447,8 +424,10 @@ def list_available_sizes( :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.v2017_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -456,36 +435,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,6 +479,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py index 0bb073e1a16f..81472a9e8956 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2017_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2017_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,27 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -346,8 +323,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -362,15 +342,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -384,24 +368,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -413,8 +390,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -440,29 +419,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -476,8 +444,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -489,7 +460,8 @@ def list_by_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.v2017_12_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -497,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -543,11 +511,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -557,7 +527,8 @@ def list( :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.v2017_12_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -565,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py index 590ad85bfa5b..bdecf96b05f1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2017_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py index ced31d9261f9..963bc2b683d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2017_12_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py index c6ef23a7adc3..a324c5e269d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2017_12_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py index 49353c35e322..5a3df28e3470 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py index 9601b787802c..fab29e63b43e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,28 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +339,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +361,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,25 +388,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,8 +410,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -462,30 +442,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -499,4 +468,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py index deb4108e3756..5b816bf88ca1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py index bcb850b9f52a..e150368883f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2017_12_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index b9b1d3954d65..a9538a2d0faa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -192,28 +190,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,8 +217,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -248,15 +239,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,25 +266,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +288,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -331,30 +320,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,8 +346,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -383,8 +364,10 @@ def list( :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.v2017_12_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -392,36 +375,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +419,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 5031c5659f36..1e34e7a640b8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,27 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -89,8 +83,11 @@ async def _cancel_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -105,15 +102,19 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -127,24 +128,17 @@ async def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -156,6 +150,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -169,27 +164,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -205,8 +190,11 @@ async def _start_os_upgrade_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -223,15 +211,19 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,24 +237,17 @@ async def begin_start_os_upgrade( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -274,8 +259,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -298,27 +285,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -332,4 +309,6 @@ async def get_latest( 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/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index d744fb8e8e1f..b0c26623dfe7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -92,8 +87,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -111,15 +109,19 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -134,25 +136,17 @@ async def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -164,6 +158,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -178,28 +173,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -215,8 +200,11 @@ async def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -235,15 +223,19 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -258,25 +250,17 @@ async def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -288,6 +272,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -302,28 +287,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -339,8 +314,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -360,15 +338,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -383,25 +365,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -413,6 +387,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -428,33 +403,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -472,8 +437,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -495,15 +463,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -516,28 +489,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -549,6 +515,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -563,28 +530,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -600,8 +557,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -619,15 +579,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -642,25 +606,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -672,8 +628,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -699,28 +657,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -734,8 +682,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -761,28 +712,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -796,8 +737,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -823,8 +767,10 @@ def list( '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.v2017_12_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -832,42 +778,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -885,6 +828,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -902,28 +846,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -939,8 +873,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -960,15 +897,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -983,25 +924,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1013,6 +946,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1027,28 +961,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1064,8 +988,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1083,15 +1010,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1106,25 +1037,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1136,6 +1059,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1150,28 +1074,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1187,8 +1101,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1206,15 +1123,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1229,25 +1150,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1259,6 +1172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1273,28 +1187,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1310,8 +1214,11 @@ async def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1330,15 +1237,19 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1353,25 +1264,17 @@ async def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1383,6 +1286,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1397,28 +1301,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1434,8 +1328,11 @@ async def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1453,15 +1350,19 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1476,25 +1377,17 @@ async def begin_perform_maintenance( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1506,4 +1399,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py index 846bcc7e29ce..39a1c5e3bee4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,27 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -342,8 +323,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -358,15 +342,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -380,24 +368,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -409,8 +390,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -433,27 +416,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -467,8 +440,10 @@ async def get( 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, @@ -481,35 +456,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -525,8 +490,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -543,18 +511,24 @@ async def begin_deallocate( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -566,27 +540,21 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -598,6 +566,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -612,32 +581,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -653,8 +612,11 @@ async def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -669,18 +631,24 @@ async def begin_delete_instances( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -692,27 +660,21 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -724,8 +686,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -748,27 +712,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -782,8 +736,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -794,8 +751,10 @@ def list( :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.v2017_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -803,35 +762,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -849,11 +804,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -863,8 +820,10 @@ def list_all( 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.v2017_12_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -872,34 +831,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -917,11 +871,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -936,8 +892,10 @@ def list_skus( :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.v2017_12_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -945,36 +903,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -992,11 +947,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -1010,8 +967,10 @@ def get_os_upgrade_history( :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.v2017_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1019,36 +978,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1066,6 +1022,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1083,35 +1040,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1127,8 +1074,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1145,18 +1095,24 @@ async def begin_power_off( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1168,27 +1124,21 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1200,6 +1150,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1214,35 +1165,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1258,8 +1199,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1274,18 +1218,24 @@ async def begin_restart( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1297,27 +1247,21 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1329,6 +1273,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1343,35 +1288,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1387,8 +1322,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1403,18 +1341,24 @@ async def begin_start( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1426,27 +1370,21 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1458,6 +1396,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1472,35 +1411,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1516,8 +1445,11 @@ async def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1533,18 +1465,24 @@ async def begin_redeploy( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1556,27 +1494,21 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1588,6 +1520,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1602,35 +1535,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1646,8 +1569,11 @@ async def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1665,18 +1591,24 @@ async def begin_perform_maintenance( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1688,27 +1620,21 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1720,6 +1646,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1734,32 +1661,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1775,8 +1692,11 @@ async def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1791,18 +1711,24 @@ async def begin_update_instances( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1814,27 +1740,21 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1846,6 +1766,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1860,35 +1781,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1904,8 +1815,11 @@ async def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1920,18 +1834,24 @@ async def begin_reimage( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1943,27 +1863,21 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1975,6 +1889,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1989,35 +1904,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2033,8 +1938,11 @@ async def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -2050,18 +1958,24 @@ async def begin_reimage_all( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2073,27 +1987,21 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2105,8 +2013,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2134,28 +2044,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2169,4 +2069,6 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py index 4b1fd7a59d14..c3ef230b74f2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2017_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py index 26b96884998e..b134f4efc50a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_extensions_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_extensions( self, resource_group_name: str, @@ -68,29 +74,18 @@ async def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,8 +99,11 @@ async def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + + @distributed_trace def list_by_location( self, location: str, @@ -116,8 +114,10 @@ def list_by_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.v2017_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -125,35 +125,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -171,6 +167,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -188,32 +185,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,8 +216,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -249,15 +239,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +264,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,6 +290,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -315,32 +305,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -358,8 +338,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -377,15 +360,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -397,27 +385,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +411,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -443,32 +426,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -486,8 +459,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -505,15 +481,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -525,27 +506,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -557,6 +532,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -570,27 +546,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -606,8 +572,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -622,15 +591,19 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -644,24 +617,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -673,8 +639,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -688,7 +656,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -700,29 +669,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -736,8 +694,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -760,27 +721,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -794,8 +745,10 @@ async def instance_view( 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, @@ -807,27 +760,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -843,8 +786,11 @@ async def _convert_to_managed_disks_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -860,15 +806,19 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -882,24 +832,17 @@ async def begin_convert_to_managed_disks( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -911,6 +854,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -924,27 +868,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -960,8 +894,11 @@ async def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -977,15 +914,19 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -999,24 +940,17 @@ async def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1028,8 +962,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -1052,27 +988,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1086,8 +1012,11 @@ async def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1099,8 +1028,10 @@ def list( :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.v2017_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1108,35 +1039,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1154,11 +1081,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -1167,8 +1096,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2017_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1176,34 +1107,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1221,11 +1147,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1240,8 +1168,10 @@ def list_available_sizes( :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.v2017_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1249,36 +1179,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1296,6 +1223,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1312,27 +1240,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1348,8 +1266,11 @@ async def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1365,15 +1286,19 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1387,24 +1312,17 @@ async def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1416,6 +1334,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1429,27 +1348,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1465,8 +1374,11 @@ async def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1481,15 +1393,19 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1503,24 +1419,17 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1532,6 +1441,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1545,27 +1455,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1581,8 +1481,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1597,15 +1500,19 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1619,24 +1526,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1648,6 +1548,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1661,27 +1562,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1697,8 +1588,11 @@ async def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1713,15 +1607,19 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1735,24 +1633,17 @@ async def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1764,6 +1655,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1777,27 +1669,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1813,8 +1695,11 @@ async def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1829,15 +1714,19 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1851,24 +1740,17 @@ async def begin_perform_maintenance( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1880,6 +1762,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1894,32 +1777,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1935,8 +1808,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1954,15 +1830,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1974,27 +1855,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2006,4 +1881,5 @@ def get_long_running_output(pipeline_response): ) 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/v2017_12_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/__init__.py index 06de26ed757f..715992e54f6c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/__init__.py @@ -6,288 +6,147 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AdditionalUnattendContent - from ._models_py3 import ApiEntityReference - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import AutoOSUpgradePolicy - from ._models_py3 import AvailabilitySet - from ._models_py3 import AvailabilitySetListResult - from ._models_py3 import AvailabilitySetUpdate - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeLongRunningOperationProperties - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - 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 InstanceViewStatus - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - 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 OSProfile - from ._models_py3 import OperationStatusResponse - from ._models_py3 import Plan - from ._models_py3 import PurchasePlan - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - 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 Sku - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import ThrottledRequestsInput - 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 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - 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 VirtualMachineScaleSetIPConfiguration - from ._models_py3 import VirtualMachineScaleSetIdentity - from ._models_py3 import VirtualMachineScaleSetInstanceView - from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary - 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 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 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - 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 -except (SyntaxError, ImportError): - 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 AutoOSUpgradePolicy # type: ignore - from ._models import AvailabilitySet # type: ignore - from ._models import AvailabilitySetListResult # type: ignore - from ._models import AvailabilitySetUpdate # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeLongRunningOperationProperties # 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 DiagnosticsProfile # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import Image # type: ignore - from ._models import ImageDataDisk # 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 InstanceViewStatus # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 OSProfile # type: ignore - from ._models import OperationStatusResponse # type: ignore - from ._models import Plan # 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 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 Sku # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import ThrottledRequestsInput # 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 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # 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 VirtualMachineScaleSetIPConfiguration # type: ignore - from ._models import VirtualMachineScaleSetIdentity # type: ignore - from ._models import VirtualMachineScaleSetInstanceView # type: ignore - from ._models import VirtualMachineScaleSetInstanceViewStatusesSummary # 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 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 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # 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_py3 import AdditionalUnattendContent +from ._models_py3 import ApiEntityReference +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import AutoOSUpgradePolicy +from ._models_py3 import AvailabilitySet +from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import AvailabilitySetUpdate +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeLongRunningOperationProperties +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +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 InstanceViewStatus +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +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 OSProfile +from ._models_py3 import OperationStatusResponse +from ._models_py3 import Plan +from ._models_py3 import PurchasePlan +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +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 Sku +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import ThrottledRequestsInput +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 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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +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 VirtualMachineScaleSetIPConfiguration +from ._models_py3 import VirtualMachineScaleSetIdentity +from ._models_py3 import VirtualMachineScaleSetInstanceView +from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary +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 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 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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +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 ._compute_management_client_enums import ( CachingTypes, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py index 8a19df858362..344b1055104f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -37,7 +22,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -50,7 +35,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -59,7 +44,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -68,7 +53,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -77,21 +62,21 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ GENERALIZED = "Generalized" SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -99,7 +84,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -110,14 +95,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -126,7 +111,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -134,7 +119,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -142,7 +127,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. """ @@ -150,7 +135,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_LRS = "Standard_LRS" PREMIUM_LRS = "Premium_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -162,7 +147,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -170,7 +155,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -179,7 +164,7 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineEvictionPolicyTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -187,7 +172,7 @@ class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, DEALLOCATE = "Deallocate" DELETE = "Delete" -class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachinePriorityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the priority for the virtual machines in the scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -195,14 +180,14 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, REGULAR = "Regular" LOW = "Low" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models.py deleted file mode 100644 index f6737d43cd9e..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models.py +++ /dev/null @@ -1,5615 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2017_12_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2017_12_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2017_12_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class AutoOSUpgradePolicy(msrest.serialization.Model): - """The configuration parameters used for performing automatic OS upgrade. - - :param disable_auto_rollback: Whether OS image rollback feature should be disabled. Default - value is false. - :type disable_auto_rollback: bool - """ - - _attribute_map = { - 'disable_auto_rollback': {'key': 'disableAutoRollback', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoOSUpgradePolicy, self).__init__(**kwargs) - self.disable_auto_rollback = kwargs.get('disable_auto_rollback', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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. - :type sku: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.SubResource] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, - 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, - 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, - 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - 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.statuses = None - - -class AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2017_12_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.SubResource] - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2017_12_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]'}, - 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - 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.statuses = 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux 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(BootDiagnosticsInstanceView, self).__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - - -class ComputeLongRunningOperationProperties(msrest.serialization.Model): - """Compute-specific operation properties, including output. - - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'output': {'key': 'output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) - self.output = kwargs.get('output', None) - - -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.v2017_12_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. - - 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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_01.models.ManagedDiskParameters - """ - - _validation = { - 'lun': {'required': True}, - 'create_option': {'required': 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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 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.v2017_12_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 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.v2017_12_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.v2017_12_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.v2017_12_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_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 HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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.v2017_12_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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}'}, - 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Image, 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 - - -class ImageDataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_12_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.v2017_12_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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - 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) - - -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.v2017_12_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(msrest.serialization.Model): - """Describes an Operating System disk. - - All required parameters must be populated in order to send to Azure. - - :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.v2017_12_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_12_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.v2017_12_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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes - """ - - _validation = { - 'os_type': {'required': True}, - 'os_state': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_state': {'key': 'osState', 'type': 'str'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageOSDisk, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.os_state = kwargs['os_state'] - 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) - - -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 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. - - :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 - """ - - _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'}, - } - - 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) - - -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.v2017_12_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.v2017_12_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.v2017_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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'}, - } - - 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 - - -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 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.v2017_12_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 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.v2017_12_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.v2017_12_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 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.v2017_12_01.models.SshConfiguration - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - } - - 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) - - -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.v2017_12_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 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 - """ - - _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'}, - } - - 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) - - -class OperationStatusResponse(msrest.serialization.Model): - """Operation status response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2017_12_01.models.ApiError - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResponse, self).__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = None - - -class LogAnalyticsOperationResult(OperationStatusResponse): - """LogAnalytics operation status response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2017_12_01.models.ApiError - :ivar properties: LogAnalyticsOutput. - :vartype properties: ~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOutput - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - '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.v2017_12_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. Possible - values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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.v2017_12_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 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.v2017_12_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.v2017_12_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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'}, - '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.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.v2017_12_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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2017_12_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.v2017_12_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] - """ - - _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]'}, - } - - 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) - - -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 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 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.v2017_12_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'}, - 'interval_length': {'key': 'intervalLength', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RequestRateByIntervalInput, self).__init__(**kwargs) - self.interval_length = kwargs['interval_length'] - - -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.v2017_12_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 - """ - - _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'}, - } - - 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) - - -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.v2017_12_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.v2017_12_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.v2017_12_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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(OperationStatusResponse): - """Run command operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation ID. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Api error. - :vartype error: ~azure.mgmt.compute.v2017_12_01.models.ApiError - :param output: Operation output data (raw JSON). - :type output: any - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ApiError'}, - 'output': {'key': 'properties.output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(RunCommandResult, self).__init__(**kwargs) - self.output = kwargs.get('output', 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.v2017_12_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 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.v2017_12_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.v2017_12_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.v2017_12_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 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ThrottledRequestsInput, self).__init__(**kwargs) - - -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.v2017_12_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.v2017_12_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2017_12_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set - instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool - :param auto_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type auto_os_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.AutoOSUpgradePolicy - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'rolling_upgrade_policy': {'key': 'rollingUpgradePolicy', 'type': 'RollingUpgradePolicy'}, - 'automatic_os_upgrade': {'key': 'automaticOSUpgrade', 'type': 'bool'}, - 'auto_os_upgrade_policy': {'key': 'autoOSUpgradePolicy', 'type': 'AutoOSUpgradePolicy'}, - } - - 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 = kwargs.get('automatic_os_upgrade', None) - self.auto_os_upgrade_policy = kwargs.get('auto_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: An enum describing the unit of usage measurement. Has constant 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.v2017_12_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 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.v2017_12_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', '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'}, - } - - 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.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2017_12_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_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 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): - """Resource Id. - - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'output': {'key': 'properties.output', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineCaptureResult, self).__init__(**kwargs) - self.output = kwargs.get('output', 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2017_12_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'}, - '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.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.v2017_12_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.v2017_12_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_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.v2017_12_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2017_12_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.v2017_12_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the Virtual Machine. The user - identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] - """ - - _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'}, - 'identity_ids': {'key': 'identityIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.identity_ids = kwargs.get('identity_ids', 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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2017_12_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2017_12_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2017_12_01.models.DataDiskImage] - """ - - _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}'}, - 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2017_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2017_12_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView] - :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.v2017_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] - """ - - _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'}, - '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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2017_12_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 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.v2017_12_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.v2017_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2017_12_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 - :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. - :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 - """ - - _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]'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'overprovision': {'key': 'properties.overprovision', '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'}, - } - - 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.upgrade_policy = kwargs.get('upgrade_policy', None) - self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.provisioning_state = None - self.overprovision = kwargs.get('overprovision', 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) - - -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.v2017_12_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.v2017_12_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.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _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'}, - } - - 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) - - -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 - :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: 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - 'settings': {'key': 'properties.settings', 'type': 'object'}, - 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - 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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provisioning_state = 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.v2017_12_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.v2017_12_01.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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.v2017_12_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the virtual machine scale set. - The user identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] - """ - - _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'}, - 'identity_ids': {'key': 'identityIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.identity_ids = kwargs.get('identity_ids', 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.v2017_12_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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 load balancer. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2017_12_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_12_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]'}, - '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.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 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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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. Managed - OS disk storage account type can only be set when you create the scale set. Possible values - are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2017_12_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'}, - '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.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.v2017_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_01.models.DiskCreateOptionTypes - :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.v2017_12_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2017_12_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.v2017_12_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'}, - '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.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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - """ - - _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'}, - } - - 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) - - -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 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.v2017_12_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2017_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: 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 - """ - - _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'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetUpdateVMProfile'}, - 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, - 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, - } - - 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.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.overprovision = kwargs.get('overprovision', None) - self.single_placement_group = kwargs.get('single_placement_group', None) - - -class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): - """Describes a virtual machine scale set network profile's IP configuration. - - :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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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.v2017_12_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]'}, - '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.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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2017_12_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'}, - '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.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 network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) - 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.v2017_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or - disabled on the disk. - :type write_accelerator_enabled: bool - :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.v2017_12_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.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _attribute_map = { - 'caching': {'key': 'caching', 'type': 'str'}, - 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, - '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.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.v2017_12_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - 'license_type': {'key': 'licenseType', '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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - self.license_type = kwargs.get('license_type', 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.v2017_12_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.v2017_12_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] - :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_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.v2017_12_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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'instance_id': {'readonly': True}, - 'sku': {'readonly': True}, - 'resources': {'readonly': True}, - 'latest_model_applied': {'readonly': True}, - 'vm_id': {'readonly': True}, - 'instance_view': {'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'}, - '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]'}, - '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'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVM, self).__init__(**kwargs) - self.instance_id = None - self.sku = None - self.plan = kwargs.get('plan', None) - self.resources = 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.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', 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) - - -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.v2017_12_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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2017_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2017_12_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2017_12_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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.v2017_12_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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". - :type priority: str or ~azure.mgmt.compute.v2017_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority - scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values - include: "Deallocate", "Delete". - :type eviction_policy: str or - ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineEvictionPolicyTypes - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - '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'}, - } - - 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.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) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2017_12_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_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.v2017_12_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.v2017_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_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 virtual machine is enabled for automatic - updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :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.v2017_12_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2017_12_01.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2017_12_01.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2017_12_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2017_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models_py3.py index b97c563489fe..7d7591ee39b0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models_py3.py @@ -17,21 +17,21 @@ 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2017_12_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2017_12_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -50,6 +50,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2017_12_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -60,9 +77,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -75,6 +92,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -82,16 +104,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2017_12_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2017_12_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2017_12_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2017_12_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -112,6 +134,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2017_12_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2017_12_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -123,12 +157,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -145,6 +179,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -154,9 +196,9 @@ def __init__( class AutoOSUpgradePolicy(msrest.serialization.Model): """The configuration parameters used for performing automatic OS upgrade. - :param disable_auto_rollback: Whether OS image rollback feature should be disabled. Default + :ivar disable_auto_rollback: Whether OS image rollback feature should be disabled. Default value is false. - :type disable_auto_rollback: bool + :vartype disable_auto_rollback: bool """ _attribute_map = { @@ -169,6 +211,11 @@ def __init__( disable_auto_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword disable_auto_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :paramtype disable_auto_rollback: bool + """ super(AutoOSUpgradePolicy, self).__init__(**kwargs) self.disable_auto_rollback = disable_auto_rollback @@ -186,10 +233,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -214,6 +261,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -235,18 +288,18 @@ class AvailabilitySet(Resource): :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. - :type sku: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.SubResource] + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2017_12_01.models.SubResource] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ @@ -283,6 +336,21 @@ def __init__( virtual_machines: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -296,11 +364,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -319,6 +387,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -327,8 +402,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -341,6 +416,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -350,16 +429,16 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2017_12_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.v2017_12_01.models.SubResource] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2017_12_01.models.SubResource] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ @@ -387,6 +466,19 @@ def __init__( virtual_machines: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -398,11 +490,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -417,6 +509,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -447,6 +546,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -455,8 +556,8 @@ def __init__( class ComputeLongRunningOperationProperties(msrest.serialization.Model): """Compute-specific operation properties, including output. - :param output: Operation output data (raw JSON). - :type output: any + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -469,6 +570,10 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(ComputeLongRunningOperationProperties, self).__init__(**kwargs) self.output = output @@ -494,6 +599,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -539,6 +646,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -553,41 +662,41 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2017_12_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :ivar 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.v2017_12_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :ivar 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.v2017_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2017_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :ivar 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.v2017_12_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.ManagedDiskParameters """ _validation = { @@ -621,6 +730,43 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.ManagedDiskParameters + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -655,6 +801,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -662,11 +810,11 @@ def __init__( 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 + :ivar 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.v2017_12_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2017_12_01.models.BootDiagnostics """ _attribute_map = { @@ -679,6 +827,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2017_12_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -686,13 +841,13 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2017_12_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2017_12_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -709,6 +864,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2017_12_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2017_12_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -718,13 +882,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2017_12_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2017_12_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -741,6 +906,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2017_12_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -750,7 +925,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -796,7 +971,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2017_12_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -809,6 +984,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -826,14 +1050,14 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -866,6 +1090,16 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -877,30 +1111,31 @@ class ImageDataDisk(msrest.serialization.Model): 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 + :ivar 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype lun: int + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2017_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :ivar 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. Possible + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes """ _validation = { @@ -929,6 +1164,33 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + """ super(ImageDataDisk, self).__init__(**kwargs) self.lun = lun self.snapshot = snapshot @@ -944,11 +1206,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2017_12_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -967,6 +1229,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -977,33 +1246,34 @@ class ImageOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. This property allows you to specify the type of the OS that is + :ivar 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.v2017_12_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemStateTypes + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2017_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :ivar 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. Possible + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes """ _validation = { @@ -1035,6 +1305,37 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemStateTypes + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + """ super(ImageOSDisk, self).__init__(**kwargs) self.os_type = os_type self.os_state = os_state @@ -1049,8 +1350,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1063,6 +1364,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1070,21 +1375,21 @@ def __init__( 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. - :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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -1105,6 +1410,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -1115,19 +1437,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2017_12_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2017_12_01.models.ImageOSDisk + :ivar 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.v2017_12_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -1144,6 +1466,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2017_12_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -1155,12 +1492,12 @@ class ImageUpdate(UpdateResource): 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.v2017_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -1184,6 +1521,14 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.ImageStorageProfile + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1193,10 +1538,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -1211,6 +1556,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -1219,16 +1570,16 @@ def __init__( 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.v2017_12_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2017_12_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -1249,6 +1600,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2017_12_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -1262,10 +1625,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2017_12_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2017_12_01.models.SubResource """ _validation = { @@ -1285,6 +1648,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2017_12_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -1295,10 +1664,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2017_12_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2017_12_01.models.SubResource """ _validation = { @@ -1318,6 +1687,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2017_12_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -1326,11 +1701,11 @@ def __init__( 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 + :ivar 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.v2017_12_01.models.SshConfiguration + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2017_12_01.models.SshConfiguration """ _attribute_map = { @@ -1345,6 +1720,13 @@ def __init__( ssh: Optional["SshConfiguration"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2017_12_01.models.SshConfiguration + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -1355,11 +1737,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2017_12_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1378,6 +1760,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1388,19 +1777,19 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -1429,6 +1818,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -1475,6 +1879,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusResponse, self).__init__(**kwargs) self.name = None self.status = None @@ -1524,6 +1930,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -1549,6 +1957,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -1556,23 +1966,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2017_12_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -1597,6 +2007,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2017_12_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -1610,12 +2039,13 @@ def __init__( 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. Possible + :ivar id: Resource Id. + :vartype id: str + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes """ _attribute_map = { @@ -1630,6 +2060,15 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type @@ -1637,11 +2076,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -1656,6 +2095,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -1663,9 +2109,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2017_12_01.models.NetworkInterfaceReference] """ @@ -1679,6 +2125,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2017_12_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -1688,45 +2140,45 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2017_12_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2017_12_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2017_12_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :ivar 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.v2017_12_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :ivar 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.v2017_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2017_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :ivar 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.v2017_12_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.ManagedDiskParameters """ _validation = { @@ -1761,6 +2213,47 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2017_12_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -1779,9 +2272,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes """ _validation = { @@ -1798,6 +2291,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -1805,29 +2303,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -1842,27 +2339,26 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration + :ivar 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.v2017_12_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] """ _attribute_map = { @@ -1887,6 +2383,66 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -1900,15 +2456,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -1927,6 +2483,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -1939,13 +2506,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -1968,6 +2535,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -2000,6 +2576,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -2010,22 +2588,22 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 interval_length: Required. Interval value in minutes used to create LogAnalytics call + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar 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.v2017_12_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2017_12_01.models.IntervalInMins """ _validation = { @@ -2057,6 +2635,24 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2017_12_01.models.IntervalInMins + """ 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, **kwargs) self.interval_length = interval_length @@ -2091,6 +2687,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -2100,26 +2698,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -2144,6 +2742,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -2185,6 +2805,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -2227,6 +2849,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -2247,10 +2871,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -2292,6 +2916,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -2304,17 +2934,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_12_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 + :vartype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -2343,6 +2973,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -2356,21 +2999,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2017_12_01.models.RunCommandParameterDefinition] """ _validation = { @@ -2404,6 +3047,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2017_12_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -2414,13 +3075,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2017_12_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2017_12_01.models.RunCommandInputParameter] """ _validation = { @@ -2441,6 +3102,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2017_12_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -2452,10 +3122,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -2475,6 +3145,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -2485,11 +3161,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2017_12_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2508,6 +3184,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2518,14 +3201,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -2549,6 +3232,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -2571,8 +3264,8 @@ class RunCommandResult(OperationStatusResponse): :vartype end_time: ~datetime.datetime :ivar error: Api error. :vartype error: ~azure.mgmt.compute.v2017_12_01.models.ApiError - :param output: Operation output data (raw JSON). - :type output: any + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _validation = { @@ -2598,6 +3291,10 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(RunCommandResult, self).__init__(**kwargs) self.output = output @@ -2605,14 +3302,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -2629,6 +3326,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2638,8 +3345,8 @@ def __init__( 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.v2017_12_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2017_12_01.models.SshPublicKey] """ _attribute_map = { @@ -2652,6 +3359,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2017_12_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -2659,15 +3370,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -2682,6 +3393,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -2690,21 +3412,21 @@ def __init__( 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 + :ivar 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.v2017_12_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2017_12_01.models.ImageReference + :ivar 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.v2017_12_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2017_12_01.models.OSDisk + :ivar 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.v2017_12_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.DataDisk] """ _attribute_map = { @@ -2721,6 +3443,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2017_12_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2017_12_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -2748,6 +3487,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -2757,19 +3498,19 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -2798,6 +3539,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ 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, **kwargs) @@ -2831,6 +3587,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -2879,6 +3637,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -2918,6 +3678,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -2927,22 +3689,22 @@ def __init__( 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.v2017_12_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2017_12_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool - :param auto_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype automatic_os_upgrade: bool + :ivar auto_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type auto_os_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.AutoOSUpgradePolicy + :vartype auto_os_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.AutoOSUpgradePolicy """ _attribute_map = { @@ -2961,6 +3723,24 @@ def __init__( auto_os_upgrade_policy: Optional["AutoOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2017_12_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + instances in a rolling fashion when a newer version of the image becomes available. + :paramtype automatic_os_upgrade: bool + :keyword auto_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype auto_os_upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.AutoOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -2977,12 +3757,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2017_12_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2017_12_01.models.UsageName """ _validation = { @@ -3009,6 +3789,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2017_12_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -3018,10 +3806,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -3036,6 +3824,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -3044,21 +3838,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -3073,6 +3867,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -3081,12 +3892,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2017_12_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2017_12_01.models.VaultCertificate] """ _attribute_map = { @@ -3101,6 +3912,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2017_12_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -3109,8 +3928,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -3123,6 +3942,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -3140,34 +3963,34 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2017_12_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :ivar 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 @@ -3177,12 +4000,12 @@ class VirtualMachine(Resource): `_ :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.v2017_12_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -3190,7 +4013,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -3246,6 +4069,53 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -3266,13 +4136,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3289,6 +4159,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -3300,13 +4179,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -3329,6 +4208,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -3338,10 +4226,10 @@ def __init__( class VirtualMachineCaptureResult(SubResource): """Resource Id. - :param id: Resource Id. - :type id: str - :param output: Operation output data (raw JSON). - :type output: any + :ivar id: Resource Id. + :vartype id: str + :ivar output: Operation output data (raw JSON). + :vartype output: any """ _attribute_map = { @@ -3356,6 +4244,12 @@ def __init__( output: Optional[Any] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword output: Operation output data (raw JSON). + :paramtype output: any + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.output = output @@ -3373,33 +4267,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2017_12_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -3442,6 +4337,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -3457,12 +4380,12 @@ def __init__( 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.v2017_12_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus """ _attribute_map = { @@ -3479,6 +4402,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -3498,23 +4429,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -3549,6 +4480,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -3560,16 +4510,16 @@ def __init__( 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.v2017_12_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3590,6 +4540,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -3601,8 +4563,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -3615,6 +4577,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -3622,26 +4588,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -3668,6 +4634,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -3699,6 +4687,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -3714,15 +4704,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2017_12_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the Virtual Machine. The user + :vartype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType + :ivar identity_ids: The list of user identities associated with the Virtual Machine. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] + :vartype identity_ids: list[str] """ _validation = { @@ -3744,6 +4734,17 @@ def __init__( identity_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType + :keyword identity_ids: The list of user identities associated with the Virtual Machine. The + user identity references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. + :paramtype identity_ids: list[str] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -3756,16 +4757,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -3789,6 +4790,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -3800,23 +4813,23 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2017_12_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2017_12_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2017_12_01.models.DataDiskImage] + :vartype plan: ~azure.mgmt.compute.v2017_12_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2017_12_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2017_12_01.models.DataDiskImage] """ _validation = { @@ -3846,6 +4859,25 @@ def __init__( data_disk_images: Optional[List["DataDiskImage"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2017_12_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2017_12_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2017_12_01.models.DataDiskImage] + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -3855,35 +4887,35 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2017_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2017_12_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2017_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2017_12_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3918,6 +4950,37 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2017_12_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2017_12_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -3938,11 +5001,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2017_12_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3961,6 +5024,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3979,43 +5049,42 @@ class VirtualMachineScaleSet(Resource): :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.v2017_12_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :ivar 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.v2017_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2017_12_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: 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, + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool - :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int """ _validation = { @@ -4064,6 +5133,41 @@ def __init__( platform_fault_domain_count: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -4084,30 +5188,30 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2017_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -4138,6 +5242,33 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -4155,26 +5286,26 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: str - :param force_update_tag: If a value is provided and is different from the previous value, the + :ivar name: The name of the extension. + :vartype name: str + :ivar 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: 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str """ @@ -4210,6 +5341,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.force_update_tag = force_update_tag @@ -4227,11 +5380,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2017_12_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4250,6 +5403,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4258,8 +5418,9 @@ def __init__( 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.v2017_12_01.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -4272,6 +5433,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -4287,16 +5453,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2017_12_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the virtual machine scale set. + :vartype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType + :ivar identity_ids: The list of user identities associated with the virtual machine scale set. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] + :vartype identity_ids: list[str] """ _validation = { @@ -4318,6 +5484,18 @@ def __init__( identity_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType + :keyword identity_ids: The list of user identities associated with the virtual machine scale + set. The user identity references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. + :paramtype identity_ids: list[str] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -4336,8 +5514,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ _validation = { @@ -4357,6 +5535,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -4385,6 +5567,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -4394,36 +5578,37 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2017_12_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2017_12_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2017_12_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2017_12_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :ivar 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 load balancer. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + :ivar 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 load balancer. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_12_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_12_01.models.SubResource] """ _validation = { @@ -4456,6 +5641,39 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2017_12_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -4472,11 +5690,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2017_12_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2017_12_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4495,6 +5714,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2017_12_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4505,11 +5732,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2017_12_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4528,6 +5755,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4538,11 +5772,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2017_12_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4561,6 +5795,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4571,11 +5812,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2017_12_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4594,6 +5835,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4602,10 +5850,11 @@ def __init__( 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. Managed - OS disk storage account type can only be set when you create the scale set. Possible values - are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + :ivar storage_account_type: 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. Possible values are: + Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes """ _attribute_map = { @@ -4618,6 +5867,13 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values + are: Standard_LRS or Premium_LRS. Possible values include: "Standard_LRS", "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2017_12_01.models.StorageAccountTypes + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type @@ -4627,26 +5883,26 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -4677,6 +5933,28 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -4690,8 +5968,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -4704,6 +5982,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -4711,12 +5993,12 @@ def __init__( 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 + :ivar 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.v2017_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -4732,6 +6014,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -4742,36 +6033,36 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2017_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2017_12_01.models.DiskCreateOptionTypes - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :ivar 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.v2017_12_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -4803,6 +6094,39 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2017_12_01.models.DiskCreateOptionTypes + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2017_12_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -4817,25 +6141,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -4850,27 +6173,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration + :ivar 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.v2017_12_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.v2017_12_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] """ _attribute_map = { @@ -4895,6 +6218,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -4910,12 +6289,12 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -4937,6 +6316,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -4948,10 +6336,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -4968,6 +6356,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -5001,6 +6395,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -5042,6 +6438,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -5052,21 +6450,22 @@ def __init__( 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 + :ivar 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.v2017_12_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2017_12_01.models.ImageReference + :ivar 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.v2017_12_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2017_12_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -5083,6 +6482,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2017_12_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5092,27 +6509,26 @@ def __init__( 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.v2017_12_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2017_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: bool - :param single_placement_group: When true this limits the scale set to a single placement group, + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype single_placement_group: bool """ _attribute_map = { @@ -5139,6 +6555,29 @@ def __init__( single_placement_group: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2017_12_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2017_12_01.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype single_placement_group: bool + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -5152,31 +6591,31 @@ def __init__( class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): """Describes a virtual machine scale set network profile's IP configuration. - :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.v2017_12_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2017_12_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2017_12_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2017_12_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.SubResource] """ _attribute_map = { @@ -5205,6 +6644,34 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2017_12_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2017_12_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -5219,25 +6686,25 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -5264,6 +6731,27 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -5277,8 +6765,8 @@ def __init__( class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -5292,6 +6780,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -5299,19 +6792,19 @@ def __init__( 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.v2017_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or disabled on the disk. - :type write_accelerator_enabled: bool - :param image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before + :vartype write_accelerator_enabled: bool + :ivar 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.v2017_12_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: + :vartype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -5333,6 +6826,22 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2017_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2017_12_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -5344,14 +6853,14 @@ def __init__( 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.v2017_12_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] """ _attribute_map = { @@ -5370,6 +6879,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2017_12_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -5380,12 +6899,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -5403,6 +6922,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -5412,12 +6940,13 @@ def __init__( 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.v2017_12_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2017_12_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -5434,6 +6963,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2017_12_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5443,21 +6981,22 @@ def __init__( 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.v2017_12_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str """ _attribute_map = { @@ -5480,6 +7019,24 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -5502,20 +7059,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2017_12_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2017_12_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual @@ -5526,18 +7083,18 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :ivar 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 @@ -5547,10 +7104,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2017_12_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2017_12_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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -5558,7 +7115,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -5613,6 +7170,49 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -5657,6 +7257,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -5665,10 +7267,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -5681,6 +7283,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -5690,8 +7298,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -5708,6 +7316,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -5717,34 +7329,34 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2017_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2017_12_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2017_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2017_12_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -5780,6 +7392,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2017_12_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2017_12_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2017_12_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -5799,11 +7439,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5822,6 +7462,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5830,24 +7477,24 @@ def __init__( 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.v2017_12_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -5855,15 +7502,15 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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. + :vartype license_type: str + :ivar 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". - :type priority: str or ~azure.mgmt.compute.v2017_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority + :vartype priority: str or ~azure.mgmt.compute.v2017_12_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or + :vartype eviction_policy: str or ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineEvictionPolicyTypes """ @@ -5891,6 +7538,43 @@ def __init__( eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2017_12_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for virtual machines in a low priority + scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values + include: "Deallocate", "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineEvictionPolicyTypes + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -5905,20 +7589,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -5941,6 +7625,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -5953,8 +7653,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSize] """ _attribute_map = { @@ -5967,6 +7667,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -5996,6 +7700,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -6006,30 +7712,30 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2017_12_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :ivar 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 @@ -6039,12 +7745,12 @@ class VirtualMachineUpdate(UpdateResource): `_ :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.v2017_12_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2017_12_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.v2017_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6052,7 +7758,7 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -6097,6 +7803,51 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2017_12_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2017_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2017_12_01.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2017_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2017_12_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2017_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -6116,23 +7867,23 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2017_12_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2017_12_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2017_12_01.models.WinRMConfiguration """ _attribute_map = { @@ -6153,6 +7904,26 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + updates. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2017_12_01.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2017_12_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -6164,8 +7935,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2017_12_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2017_12_01.models.WinRMListener] """ _attribute_map = { @@ -6178,6 +7949,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2017_12_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -6185,18 +7960,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2017_12_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2017_12_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -6211,6 +7986,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2017_12_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py index a38cbc39e245..1bd03ffed60c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py @@ -5,23 +5,287 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +309,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +335,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +364,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +394,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +423,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,27 +450,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +476,17 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -263,27 +503,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -297,22 +527,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2017_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -320,36 +554,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -367,24 +596,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2017_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -392,35 +624,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -438,18 +666,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -458,8 +687,10 @@ def list_available_sizes( :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.v2017_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -467,36 +698,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -514,6 +742,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py index 822706e65b8a..8eb8377feba4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py @@ -5,25 +5,254 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +278,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +321,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +343,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2017_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +366,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +392,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +440,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +462,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2017_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +485,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,41 +511,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -355,15 +551,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -372,15 +570,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -394,24 +596,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -423,16 +618,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -451,29 +647,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -487,14 +672,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -509,35 +696,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -555,16 +738,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -578,34 +762,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -623,6 +802,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py index 709712c8fd20..cbf8451e1286 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2017_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py index 4e7caf566901..b308cf831c18 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2017_12_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py index 13017bce982d..509b0757f087 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py index 9ed90523be3c..42841c78e9ab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2017_12_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extensions_operations.py index 5f4c48a2dcf3..fa73aaaa800d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,197 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +221,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +266,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +293,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +319,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +345,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +391,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +414,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +444,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,43 +470,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +512,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -389,15 +534,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,25 +561,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,17 +583,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -473,30 +615,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,4 +641,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py index 16cdc4efcce4..d6d2e0226d09 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2017_12_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_run_commands_operations.py index a0fe433da375..4776f5d45875 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2017_12_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py index 8581103d65bb..c0a1ec42675a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,187 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +211,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +256,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +280,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +310,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,43 +336,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - vmss_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,16 +378,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -256,15 +400,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,25 +427,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,17 +449,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -340,30 +481,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,15 +507,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -393,8 +525,10 @@ def list( :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.v2017_12_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -402,36 +536,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -449,6 +580,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 7045b96cf51c..5f62f6d7dbdb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,131 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,37 +155,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,15 +190,17 @@ def _cancel_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -111,15 +209,19 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,24 +235,17 @@ def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -162,41 +257,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,15 +297,17 @@ def _start_os_upgrade_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -231,15 +318,19 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -253,24 +344,17 @@ def begin_start_os_upgrade( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -282,15 +366,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -307,27 +392,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -341,4 +416,6 @@ def get_latest( 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/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py index 651e8157fa62..6440003cf45c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,526 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,39 +550,28 @@ def __init__(self, client, config, serializer, deserializer): def _reimage_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,16 +587,18 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -117,15 +609,19 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,25 +636,17 @@ def begin_reimage( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -170,43 +658,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,16 +700,18 @@ def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -243,15 +723,19 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -266,25 +750,17 @@ def begin_reimage_all( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -296,43 +772,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -348,16 +814,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -370,15 +838,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -393,25 +865,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -423,49 +887,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -483,17 +937,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -507,15 +963,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -528,28 +989,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -561,43 +1015,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -613,16 +1057,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -633,15 +1079,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -656,25 +1106,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -686,16 +1128,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -714,28 +1157,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -749,16 +1182,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -777,28 +1212,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -812,18 +1237,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -840,8 +1267,10 @@ def list( '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.v2017_12_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -849,42 +1278,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -902,6 +1328,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -909,39 +1336,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -957,16 +1373,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -979,15 +1397,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1002,25 +1424,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1032,43 +1446,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1084,16 +1488,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1104,15 +1510,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1127,25 +1537,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1157,43 +1559,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1209,16 +1601,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1229,15 +1623,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1252,25 +1650,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1282,43 +1672,33 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1334,16 +1714,18 @@ def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1355,15 +1737,19 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1378,25 +1764,17 @@ def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1408,43 +1786,33 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1460,16 +1828,18 @@ def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1480,15 +1850,19 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1503,25 +1877,17 @@ def begin_perform_maintenance( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1533,4 +1899,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py index 7eefa019ff30..461313db0a74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,833 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +857,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +900,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +922,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +947,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +973,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +1017,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1039,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1064,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,41 +1090,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - 'subscriptionId': self._serialize.url("self._config.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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,15 +1130,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -368,15 +1149,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -390,24 +1175,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -419,15 +1197,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -444,27 +1223,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -478,50 +1247,41 @@ def get( 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -537,16 +1297,18 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -556,18 +1318,24 @@ def begin_deallocate( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -579,27 +1347,21 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -611,47 +1373,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # 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') + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -667,16 +1419,18 @@ def _delete_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -684,18 +1438,24 @@ def begin_delete_instances( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -707,27 +1467,21 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -739,15 +1493,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -764,27 +1519,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -798,21 +1543,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2017_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -820,35 +1569,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -866,23 +1611,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2017_12_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -890,34 +1638,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -935,18 +1678,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -955,8 +1699,10 @@ def list_skus( :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.v2017_12_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -964,36 +1710,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1011,18 +1754,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1030,8 +1774,10 @@ def get_os_upgrade_history( :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.v2017_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1039,36 +1785,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1086,6 +1829,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1093,46 +1837,35 @@ def get_next(next_link=None): def _power_off_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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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] - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1148,16 +1881,18 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1167,18 +1902,24 @@ def begin_power_off( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1190,27 +1931,21 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1222,50 +1957,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1281,16 +2006,18 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1298,18 +2025,24 @@ def begin_restart( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1321,27 +2054,21 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1353,50 +2080,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1412,16 +2129,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1429,18 +2148,24 @@ def begin_start( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1452,27 +2177,21 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1484,50 +2203,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1543,16 +2252,18 @@ def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them back on. @@ -1561,18 +2272,24 @@ def begin_redeploy( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1584,27 +2301,21 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1616,50 +2327,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1675,16 +2376,18 @@ def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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: @@ -1695,18 +2398,24 @@ def begin_perform_maintenance( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1718,27 +2427,21 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1750,47 +2453,37 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # 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') + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1806,16 +2499,18 @@ def _update_instances_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1823,18 +2518,24 @@ def begin_update_instances( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1846,27 +2547,21 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1878,50 +2573,40 @@ def get_long_running_output(pipeline_response): ) 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_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if vm_instance_i_ds is not None: - body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1937,16 +2622,18 @@ def _reimage_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1954,18 +2641,24 @@ def begin_reimage( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1977,27 +2670,21 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2009,50 +2696,40 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "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') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2068,16 +2745,18 @@ def _reimage_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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["_models.OperationStatusResponse"] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @@ -2086,18 +2765,24 @@ def begin_reimage_all( :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2109,27 +2794,21 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2141,16 +2820,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2171,28 +2851,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2206,4 +2876,6 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py index ec47c1b2ed05..2033c987be69 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,19 +80,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes for a subscription in a location. :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.v2017_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -65,35 +102,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py index 72cdb79f184d..623d67f151ac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py @@ -5,25 +5,764 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_extensions_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,14 +786,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_extensions( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -73,29 +812,18 @@ def get_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # Construct URL - url = self.get_extensions.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 = build_get_extensions_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,21 +837,25 @@ def get_extensions( return cls(pipeline_response, deserialized, {}) return deserialized + get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2017_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -131,35 +863,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -177,6 +905,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -184,43 +913,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -236,16 +954,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -257,15 +977,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2017_12_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +1002,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,47 +1028,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -367,16 +1076,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -387,15 +1098,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2017_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -407,27 +1122,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,47 +1148,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -497,16 +1196,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -517,15 +1218,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2017_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -537,27 +1242,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -569,41 +1268,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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'), - '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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -619,15 +1308,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -636,15 +1327,19 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -658,24 +1353,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -687,23 +1375,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -715,29 +1405,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -751,15 +1430,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -776,27 +1457,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -810,41 +1481,32 @@ def instance_view( 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -860,15 +1522,17 @@ def _convert_to_managed_disks_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -878,15 +1542,19 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -900,24 +1568,17 @@ def begin_convert_to_managed_disks( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -929,41 +1590,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -979,15 +1630,17 @@ def _deallocate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses. @@ -997,15 +1650,19 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1019,24 +1676,17 @@ def begin_deallocate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1048,15 +1698,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResponse" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.OperationStatusResponse": """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -1073,27 +1724,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "application/json" - - # 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] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1107,22 +1748,26 @@ def generalize( return cls(pipeline_response, deserialized, {}) return deserialized + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2017_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1130,35 +1775,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1176,22 +1817,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2017_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1199,34 +1843,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1244,18 +1883,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1264,8 +1904,10 @@ def list_available_sizes( :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.v2017_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1273,36 +1915,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1320,6 +1959,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1327,37 +1967,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1373,15 +2002,17 @@ def _power_off_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1391,15 +2022,19 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1413,24 +2048,17 @@ def begin_power_off( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1442,41 +2070,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1492,15 +2110,17 @@ def _restart_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1509,15 +2129,19 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1531,24 +2155,17 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1560,41 +2177,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1610,15 +2217,17 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1627,15 +2236,19 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1649,24 +2262,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1678,41 +2284,31 @@ def get_long_running_output(pipeline_response): ) 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: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1728,15 +2324,17 @@ def _redeploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """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. @@ -1745,15 +2343,19 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1767,24 +2369,17 @@ def begin_redeploy( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1796,41 +2391,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-12-01" - accept = "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'), - '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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1846,15 +2431,17 @@ def _perform_maintenance_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatusResponse"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResponse"]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -1863,15 +2450,19 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationStatusResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1885,24 +2476,17 @@ def begin_perform_maintenance( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResponse', 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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1914,47 +2498,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2017-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1970,16 +2544,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -1990,15 +2566,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2017_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2017_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2010,27 +2590,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2042,4 +2616,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py index fc297668612c..99c61789eefd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py @@ -6,159 +6,143 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2018_04_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2018_04_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2018_04_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2018_04_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2018_04_01.operations.ProximityPlacementGroupsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2018_04_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2018_04_01.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2018_04_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2018_04_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2018_04_01.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2018_04_01.operations.VirtualMachineRunCommandsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2018_04_01.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2018_04_01.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py index 0c64f76330c5..2c18eba2dc6f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json index c8c00ef72eea..3ee57d4b9cc3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py index c66fc12aa65e..f4356bd4226f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py @@ -6,155 +6,144 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2018_04_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2018_04_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2018_04_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2018_04_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2018_04_01.aio.operations.ProximityPlacementGroupsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2018_04_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2018_04_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2018_04_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2018_04_01.aio.operations.VirtualMachineRunCommandsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2018_04_01.aio.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2018_04_01.aio.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py index 10389bfb4082..ef0f24180ee5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py index 5a4ee8243058..047f1c11f6a9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2018_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2018_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2018_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py index 22382e9e1778..c500c0399bf9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2018_04_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2018_04_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py index e361b67ce00e..35309c48cf56 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2018_04_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2018_04_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py index f2ac568e826a..de522ef9d2fd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_04_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py index 7ae9523fcfe2..9c4cf4f25c7f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2018_04_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py index 0e710f34d33f..9f3d91b7f65f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -252,27 +238,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -286,8 +262,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -295,8 +274,10 @@ def list_by_subscription( """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.v2018_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -304,34 +285,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -349,11 +325,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -364,8 +342,10 @@ def list_by_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.v2018_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -373,35 +353,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +395,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py index ac1a423a536b..52344076a913 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py index 382f1cbebd8c..beab75a73a1d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2018_04_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py index 0fff0193d18d..318cf791bc62 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py index 7a40a72425c1..81e78db6f802 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2018_04_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_images_operations.py index 19b915ecc334..6351f6f7c658 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py index 27732b6cf372..f05a1ff4a6b4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2018_04_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 4bb814966f9f..21e96d4bb6df 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -192,26 +190,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -224,6 +214,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -241,15 +233,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -264,22 +258,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -291,8 +277,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -321,30 +309,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -358,8 +335,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -373,8 +353,10 @@ def list( :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.v2018_04_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -382,36 +364,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +408,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 91df93246e17..4081128daf88 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,8 +237,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -278,27 +263,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -312,4 +287,6 @@ async def get_latest( 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/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index ccb95ca7e9e4..e801f1d60a40 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,26 +60,18 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - - # 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] + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -87,6 +84,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -104,15 +103,17 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -127,22 +128,14 @@ async def begin_reimage( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -154,6 +147,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -168,26 +162,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -200,6 +186,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -218,15 +206,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,22 +231,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -268,6 +250,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -282,26 +265,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -314,6 +289,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -333,15 +310,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -356,22 +335,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -383,6 +354,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -398,33 +370,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -442,8 +404,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -465,15 +430,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,28 +456,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -519,6 +482,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -533,26 +497,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -565,6 +521,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -582,15 +540,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -605,22 +565,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -632,8 +584,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -659,28 +613,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -694,8 +638,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -721,28 +668,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -756,8 +693,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -783,8 +723,10 @@ def list( '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.v2018_04_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -792,42 +734,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -845,6 +784,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -862,26 +802,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -894,6 +826,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -913,15 +847,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -936,22 +872,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -963,6 +891,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -977,26 +906,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1009,6 +930,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1026,15 +949,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1049,22 +974,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1076,6 +993,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1090,26 +1008,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1122,6 +1032,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1139,15 +1051,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1162,22 +1076,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1189,6 +1095,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1203,26 +1110,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1235,6 +1134,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1253,15 +1154,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1276,22 +1179,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1303,6 +1198,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1317,26 +1213,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1349,6 +1237,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1366,15 +1256,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1389,22 +1281,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1416,6 +1300,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1431,33 +1316,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1473,8 +1348,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1495,15 +1373,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1516,28 +1399,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1549,4 +1425,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py index d4dff44b47da..cedeade6b33d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -337,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -351,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -399,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -423,27 +405,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -457,8 +429,10 @@ async def get( 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, @@ -471,33 +445,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,6 +476,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -526,18 +494,22 @@ async def begin_deallocate( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,24 +521,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -578,6 +544,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -592,30 +559,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -628,6 +587,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -642,18 +603,22 @@ async def begin_delete_instances( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -665,24 +630,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -694,8 +653,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -718,27 +679,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -752,8 +703,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -764,8 +718,10 @@ def list( :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.v2018_04_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -773,35 +729,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -819,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -833,8 +787,10 @@ def list_all( 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.v2018_04_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -842,34 +798,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -887,11 +838,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -906,8 +859,10 @@ def list_skus( :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.v2018_04_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -915,36 +870,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -962,11 +914,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -980,8 +934,10 @@ def get_os_upgrade_history( :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.v2018_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -989,36 +945,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1036,6 +989,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1053,33 +1007,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1092,6 +1038,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1108,18 +1056,22 @@ async def begin_power_off( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1131,24 +1083,18 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1160,6 +1106,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1174,33 +1121,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1213,6 +1152,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1227,18 +1168,22 @@ async def begin_restart( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1250,24 +1195,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1279,6 +1218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1293,33 +1233,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1332,6 +1264,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1346,18 +1280,22 @@ async def begin_start( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1369,24 +1307,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1398,6 +1330,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1412,33 +1345,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1451,6 +1376,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1466,18 +1393,22 @@ async def begin_redeploy( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1489,24 +1420,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1518,6 +1443,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1532,33 +1458,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1571,6 +1489,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1588,18 +1508,22 @@ async def begin_perform_maintenance( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1611,24 +1535,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1640,6 +1558,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1654,30 +1573,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1690,6 +1601,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1704,18 +1617,22 @@ async def begin_update_instances( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,24 +1644,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1756,6 +1667,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1770,33 +1682,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1809,6 +1713,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1823,18 +1729,22 @@ async def begin_reimage( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1846,24 +1756,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1875,6 +1779,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1889,33 +1794,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1928,6 +1825,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1943,18 +1842,22 @@ async def begin_reimage_all( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1966,24 +1869,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1995,8 +1892,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2024,28 +1923,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2059,4 +1948,6 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py index 775003f706dd..c8a9c5ba6677 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2018_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py index f68a7026e27f..63e61c5ed8d9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2018_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -314,15 +305,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +330,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -366,6 +356,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -380,32 +371,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -423,8 +404,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,15 +426,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -462,27 +451,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,6 +477,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -507,25 +491,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +514,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -552,15 +530,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,21 +554,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,8 +573,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -615,7 +590,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -627,29 +603,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -663,8 +628,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -687,27 +655,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -721,8 +679,10 @@ async def instance_view( 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, @@ -734,25 +694,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -765,6 +717,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -780,15 +734,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -802,21 +758,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -828,6 +777,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -841,25 +791,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -872,6 +814,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -887,15 +831,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -909,21 +855,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -935,8 +874,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -959,25 +900,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -990,6 +923,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1001,8 +936,10 @@ def list( :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.v2018_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1010,35 +947,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,11 +989,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -1069,8 +1004,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2018_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1078,34 +1015,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1123,11 +1055,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1142,8 +1076,10 @@ def list_available_sizes( :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.v2018_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1151,36 +1087,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1198,6 +1131,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1214,25 +1148,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1245,6 +1171,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1260,15 +1188,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1282,21 +1212,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1308,6 +1231,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1321,25 +1245,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1352,6 +1268,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1366,15 +1284,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1388,21 +1308,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1414,6 +1327,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1427,25 +1341,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1458,6 +1364,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1472,15 +1380,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1494,21 +1404,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1520,6 +1423,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1533,25 +1437,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1564,6 +1460,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1578,15 +1476,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1600,21 +1500,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1626,6 +1519,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1639,25 +1533,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1670,6 +1556,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1684,15 +1572,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1706,21 +1596,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1732,6 +1615,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1746,32 +1630,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1787,8 +1661,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1806,15 +1683,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1826,27 +1708,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1858,4 +1734,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_04_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/__init__.py index b11ae09402ad..213166a49c44 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/__init__.py @@ -6,324 +6,165 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import AdditionalUnattendContent - from ._models_py3 import ApiEntityReference - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import AutoOSUpgradePolicy - from ._models_py3 import AvailabilitySet - from ._models_py3 import AvailabilitySetListResult - from ._models_py3 import AvailabilitySetUpdate - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import CreationData - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import Disk - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import EncryptionSettings - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDiskReference - 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 InstanceViewStatus - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - 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 OSProfile - 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 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 Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import ThrottledRequestsInput - 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 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - 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 VirtualMachineScaleSetIPConfiguration - from ._models_py3 import VirtualMachineScaleSetIdentity - 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 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 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - 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 -except (SyntaxError, ImportError): - from ._models import AccessUri # 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 AutoOSUpgradePolicy # type: ignore - from ._models import AvailabilitySet # type: ignore - from ._models import AvailabilitySetListResult # type: ignore - from ._models import AvailabilitySetUpdate # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeOperationListResult # type: ignore - from ._models import ComputeOperationValue # type: ignore - from ._models import CreationData # type: ignore - from ._models import DataDisk # type: ignore - from ._models import DataDiskImage # type: ignore - from ._models import DiagnosticsProfile # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import EncryptionSettings # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import Image # type: ignore - from ._models import ImageDataDisk # type: ignore - from ._models import ImageDiskReference # 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 InstanceViewStatus # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 OSProfile # 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 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 Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import ThrottledRequestsInput # 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 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # 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 VirtualMachineScaleSetIPConfiguration # type: ignore - from ._models import VirtualMachineScaleSetIdentity # 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 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 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # 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_py3 import AccessUri +from ._models_py3 import AdditionalUnattendContent +from ._models_py3 import ApiEntityReference +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import AutoOSUpgradePolicy +from ._models_py3 import AvailabilitySet +from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import AvailabilitySetUpdate +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import CreationData +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import Disk +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import EncryptionSettings +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDiskReference +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 InstanceViewStatus +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +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 OSProfile +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 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 Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import ThrottledRequestsInput +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 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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +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 VirtualMachineScaleSetIPConfiguration +from ._models_py3 import VirtualMachineScaleSetIdentity +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 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 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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +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 ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_compute_management_client_enums.py index 02ae9ee27229..f4e1e7edb3c7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_compute_management_client_enums.py @@ -6,32 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -42,7 +27,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -53,7 +38,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COPY = "Copy" RESTORE = "Restore" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -66,7 +51,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -75,7 +60,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -84,7 +69,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -93,21 +78,21 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ GENERALIZED = "Generalized" SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -115,7 +100,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -124,7 +109,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -135,14 +120,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -151,7 +136,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -159,7 +144,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -167,7 +152,7 @@ class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, PREMIUM_LRS = "Premium_LRS" STANDARD_ZRS = "Standard_ZRS" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -175,7 +160,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type for the managed disk. Possible values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. """ @@ -184,7 +169,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PREMIUM_LRS = "Premium_LRS" STANDARD_SSD_LRS = "StandardSSD_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -196,7 +181,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -204,7 +189,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -213,7 +198,7 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineEvictionPolicyTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -221,7 +206,7 @@ class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, DEALLOCATE = "Deallocate" DELETE = "Delete" -class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachinePriorityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the priority for the virtual machines in the scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -229,14 +214,14 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, REGULAR = "Regular" LOW = "Low" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_models.py deleted file mode 100644 index 4148fa117a9e..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_models.py +++ /dev/null @@ -1,6329 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = 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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2018_04_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2018_04_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2018_04_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class AutoOSUpgradePolicy(msrest.serialization.Model): - """The configuration parameters used for performing automatic OS upgrade. - - :param disable_auto_rollback: Whether OS image rollback feature should be disabled. Default - value is false. - :type disable_auto_rollback: bool - """ - - _attribute_map = { - 'disable_auto_rollback': {'key': 'disableAutoRollback', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoOSUpgradePolicy, self).__init__(**kwargs) - self.disable_auto_rollback = kwargs.get('disable_auto_rollback', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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. - :type sku: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2018_04_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2018_04_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, - **kwargs - ): - 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 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux serial console log blob Uri. - :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.v2018_04_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 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.v2018_04_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 CreationData(msrest.serialization.Model): - """Data used when creating a disk. - - All required parameters must be populated in order to send to Azure. - - :param create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". - :type create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of - the storage account containing the blob to import as a disk. Required only if the blob is in a - different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - """ - - _validation = { - 'create_option': {'required': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - - -class DataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_01.models.ManagedDiskParameters - """ - - _validation = { - 'lun': {'required': True}, - 'create_option': {'required': 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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 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.v2018_04_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 Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.provisioning_state = None - - -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.v2018_04_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.v2018_04_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.v2018_04_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_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 DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class EncryptionSettings(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettings, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2018_04_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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.v2018_04_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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}'}, - 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Image, 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 - - -class ImageDataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_04_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.v2018_04_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. Possible - values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - 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) - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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.v2018_04_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(msrest.serialization.Model): - """Describes an Operating System disk. - - All required parameters must be populated in order to send to Azure. - - :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.v2018_04_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_04_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.v2018_04_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. Possible - values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes - """ - - _validation = { - 'os_type': {'required': True}, - 'os_state': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_state': {'key': 'osState', 'type': 'str'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageOSDisk, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.os_state = kwargs['os_state'] - 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) - - -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 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. - - :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 - """ - - _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'}, - } - - 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) - - -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.v2018_04_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.v2018_04_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.v2018_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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'}, - } - - 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 - - -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 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.v2018_04_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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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.v2018_04_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.v2018_04_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 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.v2018_04_01.models.SshConfiguration - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - } - - 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) - - -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.v2018_04_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 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 - """ - - _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'}, - } - - 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) - - -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.v2018_04_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.v2018_04_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. Possible - values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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.v2018_04_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 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.v2018_04_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.v2018_04_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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'}, - '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.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.v2018_04_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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2018_04_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.v2018_04_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] - """ - - _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]'}, - } - - 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) - - -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.v2018_04_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.v2018_04_01.models.SubResource] - :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.v2018_04_01.models.SubResource] - :ivar availability_sets: A list of references to all availability sets in the proximity - placement group. - :vartype availability_sets: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] - """ - - _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': '[SubResource]'}, - 'virtual_machine_scale_sets': {'key': 'properties.virtualMachineScaleSets', 'type': '[SubResource]'}, - 'availability_sets': {'key': 'properties.availabilitySets', 'type': '[SubResource]'}, - } - - 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 - - -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.v2018_04_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 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.v2018_04_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'}, - 'interval_length': {'key': 'intervalLength', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RequestRateByIntervalInput, self).__init__(**kwargs) - self.interval_length = kwargs['interval_length'] - - -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.v2018_04_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 - """ - - _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'}, - } - - 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) - - -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.v2018_04_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.v2018_04_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.v2018_04_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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 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 Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.provisioning_state = None - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2018_04_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', 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.v2018_04_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 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.v2018_04_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.v2018_04_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.v2018_04_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 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ThrottledRequestsInput, self).__init__(**kwargs) - - -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.v2018_04_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.v2018_04_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set - instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool - :param auto_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.AutoOSUpgradePolicy - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'rolling_upgrade_policy': {'key': 'rollingUpgradePolicy', 'type': 'RollingUpgradePolicy'}, - 'automatic_os_upgrade': {'key': 'automaticOSUpgrade', 'type': 'bool'}, - 'auto_os_upgrade_policy': {'key': 'autoOSUpgradePolicy', 'type': 'AutoOSUpgradePolicy'}, - } - - 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 = kwargs.get('automatic_os_upgrade', None) - self.auto_os_upgrade_policy = kwargs.get('auto_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: An enum describing the unit of usage measurement. Has constant 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.v2018_04_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 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.v2018_04_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, - 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', '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'}, - } - - 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.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.proximity_placement_group = kwargs.get('proximity_placement_group', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2018_04_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_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 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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2018_04_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'}, - '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.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.v2018_04_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.v2018_04_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_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.v2018_04_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2018_04_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.v2018_04_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the Virtual Machine. The user - identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] - """ - - _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'}, - 'identity_ids': {'key': 'identityIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.identity_ids = kwargs.get('identity_ids', 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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2018_04_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2018_04_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2018_04_01.models.DataDiskImage] - """ - - _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}'}, - 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2018_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2018_04_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView] - :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.v2018_04_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] - """ - - _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'}, - '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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2018_04_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 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.v2018_04_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.v2018_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2018_04_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 - :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. - :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.v2018_04_01.models.SubResource - """ - - _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]'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'overprovision': {'key': 'properties.overprovision', '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'}, - } - - 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.upgrade_policy = kwargs.get('upgrade_policy', None) - self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.provisioning_state = None - self.overprovision = kwargs.get('overprovision', 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) - - -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.v2018_04_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.v2018_04_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.v2018_04_01.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _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'}, - } - - 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) - - -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 - :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: 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - 'settings': {'key': 'properties.settings', 'type': 'object'}, - 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - 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.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provisioning_state = 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.v2018_04_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.v2018_04_01.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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.v2018_04_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the virtual machine scale set. - The user identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] - """ - - _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'}, - 'identity_ids': {'key': 'identityIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.identity_ids = kwargs.get('identity_ids', 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.v2018_04_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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 load balancer. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2018_04_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_04_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]'}, - '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.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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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. Managed - OS disk storage account type can only be set when you create the scale set. Possible values - are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2018_04_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'}, - '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.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.v2018_04_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_01.models.DiskCreateOptionTypes - :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.v2018_04_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2018_04_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.v2018_04_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'}, - '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.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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIpTag] - """ - - _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]'}, - } - - 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) - - -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 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.v2018_04_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2018_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: 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 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.v2018_04_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'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetUpdateVMProfile'}, - 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, - 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, - '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.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.overprovision = kwargs.get('overprovision', None) - self.single_placement_group = kwargs.get('single_placement_group', 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. - - :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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_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]'}, - '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.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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2018_04_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'}, - '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.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 network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) - 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.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - 'license_type': {'key': 'licenseType', '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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - self.license_type = kwargs.get('license_type', 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.v2018_04_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.v2018_04_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_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.v2018_04_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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - '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}, - } - - _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}'}, - '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'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', 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) - - -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.v2018_04_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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2018_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2018_04_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2018_04_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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.v2018_04_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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". - :type priority: str or ~azure.mgmt.compute.v2018_04_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority - scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values - include: "Deallocate", "Delete". - :type eviction_policy: str or - ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineEvictionPolicyTypes - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - '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'}, - } - - 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.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) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2018_04_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_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.v2018_04_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.v2018_04_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.v2018_04_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, - 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.proximity_placement_group = kwargs.get('proximity_placement_group', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_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 virtual machine is enabled for automatic - updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :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.v2018_04_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2018_04_01.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2018_04_01.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2018_04_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2018_04_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_models_py3.py index 21ab53d3efd9..e0ad4a847ae9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,21 +44,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2018_04_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2018_04_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -75,6 +77,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2018_04_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -85,9 +104,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -100,6 +119,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -107,16 +131,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2018_04_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2018_04_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2018_04_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2018_04_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -137,6 +161,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2018_04_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2018_04_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -148,12 +184,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -170,6 +206,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -179,9 +223,9 @@ def __init__( class AutoOSUpgradePolicy(msrest.serialization.Model): """The configuration parameters used for performing automatic OS upgrade. - :param disable_auto_rollback: Whether OS image rollback feature should be disabled. Default + :ivar disable_auto_rollback: Whether OS image rollback feature should be disabled. Default value is false. - :type disable_auto_rollback: bool + :vartype disable_auto_rollback: bool """ _attribute_map = { @@ -194,6 +238,11 @@ def __init__( disable_auto_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword disable_auto_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :paramtype disable_auto_rollback: bool + """ super(AutoOSUpgradePolicy, self).__init__(**kwargs) self.disable_auto_rollback = disable_auto_rollback @@ -211,10 +260,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -239,6 +288,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -260,22 +315,22 @@ class AvailabilitySet(Resource): :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. - :type sku: ~azure.mgmt.compute.v2018_04_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.v2018_04_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: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :ivar 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.v2018_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ @@ -314,6 +369,25 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -328,11 +402,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -351,6 +425,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -359,8 +440,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -373,6 +454,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -382,20 +467,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2018_04_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.v2018_04_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :ivar 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.v2018_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ @@ -425,6 +510,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -437,11 +539,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -456,6 +558,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -491,6 +600,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -518,6 +629,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -563,6 +676,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -577,21 +692,21 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". - :type create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of + :vartype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOption + :ivar storage_account_id: If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str """ _validation = { @@ -616,6 +731,23 @@ def __init__( source_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOption + :keyword storage_account_id: If createOption is Import, the Azure Resource Manager identifier + of the storage account containing the blob to import as a disk. Required only if the blob is in + a different subscription. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -629,41 +761,41 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2018_04_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :ivar 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.v2018_04_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :ivar 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.v2018_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_04_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :ivar 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.v2018_04_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.ManagedDiskParameters """ _validation = { @@ -697,6 +829,43 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.ManagedDiskParameters + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -731,6 +900,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -738,11 +909,11 @@ def __init__( 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 + :ivar 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.v2018_04_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_04_01.models.BootDiagnostics """ _attribute_map = { @@ -755,6 +926,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_04_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -772,30 +950,30 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str """ @@ -840,6 +1018,28 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -855,13 +1055,13 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -878,6 +1078,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -887,13 +1096,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2018_04_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2018_04_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -910,6 +1120,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2018_04_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -921,11 +1141,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -944,6 +1164,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -954,9 +1181,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -976,6 +1203,11 @@ def __init__( name: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -984,19 +1216,19 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings """ _attribute_map = { @@ -1017,6 +1249,21 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, or StandardSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1028,15 +1275,15 @@ def __init__( class EncryptionSettings(msrest.serialization.Model): """Encryption settings for disk or snapshot. - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndKeyReference + :vartype enabled: bool + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :vartype key_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -1053,6 +1300,18 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword enabled: Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2018_04_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettings, self).__init__(**kwargs) self.enabled = enabled self.disk_encryption_key = disk_encryption_key @@ -1064,10 +1323,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2018_04_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read". + :vartype access: str or ~azure.mgmt.compute.v2018_04_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -1087,6 +1346,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read". + :paramtype access: str or ~azure.mgmt.compute.v2018_04_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -1095,7 +1360,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -1141,7 +1406,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2018_04_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -1154,6 +1419,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -1171,14 +1485,14 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -1211,6 +1525,16 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1222,30 +1546,31 @@ class ImageDataDisk(msrest.serialization.Model): 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 + :ivar 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype lun: int + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2018_04_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :ivar 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. Possible + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes """ _validation = { @@ -1274,6 +1599,33 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + """ super(ImageDataDisk, self).__init__(**kwargs) self.lun = lun self.snapshot = snapshot @@ -1289,12 +1641,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -1313,6 +1665,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -1323,11 +1683,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2018_04_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1346,6 +1706,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1356,33 +1723,34 @@ class ImageOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. This property allows you to specify the type of the OS that is + :ivar 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.v2018_04_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemStateTypes + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2018_04_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :ivar 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. Possible + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes """ _validation = { @@ -1414,6 +1782,37 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemStateTypes + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + """ super(ImageOSDisk, self).__init__(**kwargs) self.os_type = os_type self.os_state = os_state @@ -1428,8 +1827,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1442,6 +1841,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1449,21 +1852,21 @@ def __init__( 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. - :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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -1484,6 +1887,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -1494,19 +1914,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2018_04_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_04_01.models.ImageOSDisk + :ivar 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.v2018_04_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2018_04_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -1523,6 +1943,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_04_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2018_04_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -1534,12 +1969,12 @@ class ImageUpdate(UpdateResource): 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.v2018_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -1563,6 +1998,14 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.ImageStorageProfile + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1572,10 +2015,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -1590,6 +2033,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -1598,16 +2047,16 @@ def __init__( 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.v2018_04_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2018_04_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -1628,6 +2077,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2018_04_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -1641,10 +2102,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -1664,6 +2125,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -1674,10 +2141,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -1697,6 +2164,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -1707,10 +2180,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2018_04_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SubResource """ _validation = { @@ -1730,6 +2203,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -1740,10 +2219,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2018_04_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SubResource """ _validation = { @@ -1763,6 +2242,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -1771,11 +2256,11 @@ def __init__( 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 + :ivar 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.v2018_04_01.models.SshConfiguration + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2018_04_01.models.SshConfiguration """ _attribute_map = { @@ -1790,6 +2275,13 @@ def __init__( ssh: Optional["SshConfiguration"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2018_04_01.models.SshConfiguration + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -1800,11 +2292,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2018_04_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1823,6 +2315,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1833,19 +2332,19 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -1874,6 +2373,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -1904,6 +2418,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -1929,6 +2445,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -1936,23 +2454,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2018_04_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -1977,6 +2495,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2018_04_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -1990,12 +2527,13 @@ def __init__( 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. Possible + :ivar id: Resource Id. + :vartype id: str + :ivar storage_account_type: Specifies the storage account type for the managed disk. Possible values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes """ _attribute_map = { @@ -2010,6 +2548,15 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword storage_account_type: Specifies the storage account type for the managed disk. + Possible values are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type @@ -2017,11 +2564,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -2036,6 +2583,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -2043,9 +2597,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2018_04_01.models.NetworkInterfaceReference] """ @@ -2059,6 +2613,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2018_04_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -2068,45 +2628,45 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2018_04_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :ivar 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.v2018_04_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :ivar 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.v2018_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_04_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :ivar 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.v2018_04_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.ManagedDiskParameters """ _validation = { @@ -2141,6 +2701,47 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -2159,9 +2760,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes """ _validation = { @@ -2178,6 +2779,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -2185,29 +2791,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -2222,27 +2827,26 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration + :ivar 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.v2018_04_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] """ _attribute_map = { @@ -2267,6 +2871,66 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -2280,15 +2944,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -2307,6 +2971,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -2327,15 +3002,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -2378,6 +3053,18 @@ def __init__( proximity_placement_group_type: Optional[Union[str, "ProximityPlacementGroupType"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupType + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -2390,10 +3077,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2018_04_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -2412,6 +3099,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2420,8 +3113,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -2434,6 +3127,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -2442,13 +3139,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -2471,6 +3168,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -2503,6 +3209,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -2513,22 +3221,22 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 interval_length: Required. Interval value in minutes used to create LogAnalytics call + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar 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.v2018_04_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2018_04_01.models.IntervalInMins """ _validation = { @@ -2560,6 +3268,24 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2018_04_01.models.IntervalInMins + """ 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, **kwargs) self.interval_length = interval_length @@ -2594,6 +3320,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -2603,26 +3331,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -2647,6 +3375,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -2688,6 +3438,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -2730,6 +3482,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -2750,10 +3504,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -2795,6 +3549,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -2807,17 +3567,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_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 + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -2846,6 +3606,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -2859,21 +3632,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2018_04_01.models.RunCommandParameterDefinition] """ _validation = { @@ -2907,6 +3680,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2018_04_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -2917,13 +3708,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2018_04_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2018_04_01.models.RunCommandInputParameter] """ _validation = { @@ -2944,6 +3735,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2018_04_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -2955,10 +3755,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -2978,6 +3778,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -2988,11 +3794,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2018_04_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3011,6 +3817,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3021,14 +3834,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -3052,6 +3865,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -3062,8 +3885,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3076,6 +3899,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -3083,14 +3910,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -3107,6 +3934,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -3126,28 +3963,28 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str """ @@ -3190,6 +4027,26 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2018_04_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -3206,11 +4063,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3229,6 +4086,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3239,9 +4103,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2018_04_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2018_04_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -3261,6 +4125,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2018_04_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -3269,19 +4138,19 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings """ _attribute_map = { @@ -3302,6 +4171,21 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_04_01.models.EncryptionSettings + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -3313,8 +4197,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -3327,6 +4211,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -3334,8 +4222,8 @@ def __init__( 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.v2018_04_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2018_04_01.models.SshPublicKey] """ _attribute_map = { @@ -3348,6 +4236,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2018_04_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -3355,15 +4247,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -3378,6 +4270,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -3386,21 +4289,21 @@ def __init__( 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 + :ivar 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.v2018_04_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageReference + :ivar 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.v2018_04_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_04_01.models.OSDisk + :ivar 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.v2018_04_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2018_04_01.models.DataDisk] """ _attribute_map = { @@ -3417,6 +4320,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_04_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2018_04_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -3444,6 +4364,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -3453,19 +4375,19 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -3494,6 +4416,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ 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, **kwargs) @@ -3527,6 +4464,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -3575,6 +4514,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -3614,6 +4555,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -3623,22 +4566,22 @@ def __init__( 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.v2018_04_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2018_04_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool - :param auto_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype automatic_os_upgrade: bool + :ivar auto_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.AutoOSUpgradePolicy + :vartype auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.AutoOSUpgradePolicy """ _attribute_map = { @@ -3657,6 +4600,24 @@ def __init__( auto_os_upgrade_policy: Optional["AutoOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2018_04_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + instances in a rolling fashion when a newer version of the image becomes available. + :paramtype automatic_os_upgrade: bool + :keyword auto_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.AutoOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -3673,12 +4634,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2018_04_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2018_04_01.models.UsageName """ _validation = { @@ -3705,6 +4666,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2018_04_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -3714,10 +4683,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -3732,6 +4701,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -3740,21 +4715,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -3769,6 +4744,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -3777,12 +4769,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2018_04_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2018_04_01.models.VaultCertificate] """ _attribute_map = { @@ -3797,6 +4789,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2018_04_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -3805,8 +4805,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -3819,6 +4819,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -3836,34 +4840,34 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_04_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :ivar 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 @@ -3873,16 +4877,16 @@ class VirtualMachine(Resource): `_ :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.v2018_04_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: + :vartype availability_set: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar 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.v2018_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -3890,7 +4894,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -3948,6 +4952,57 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -3969,13 +5024,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3992,6 +5047,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -4003,13 +5067,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -4032,6 +5096,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -4043,8 +5116,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -4076,6 +5149,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -4096,33 +5173,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2018_04_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -4165,6 +5243,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -4180,12 +5286,12 @@ def __init__( 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.v2018_04_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus """ _attribute_map = { @@ -4202,6 +5308,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -4221,23 +5335,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -4272,6 +5386,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -4283,16 +5416,16 @@ def __init__( 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.v2018_04_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -4313,6 +5446,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -4324,8 +5469,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -4338,6 +5483,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -4345,26 +5494,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -4391,6 +5540,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -4422,6 +5593,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -4437,15 +5610,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2018_04_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the Virtual Machine. The user + :vartype type: str or ~azure.mgmt.compute.v2018_04_01.models.ResourceIdentityType + :ivar identity_ids: The list of user identities associated with the Virtual Machine. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] + :vartype identity_ids: list[str] """ _validation = { @@ -4467,6 +5640,17 @@ def __init__( identity_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2018_04_01.models.ResourceIdentityType + :keyword identity_ids: The list of user identities associated with the Virtual Machine. The + user identity references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. + :paramtype identity_ids: list[str] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -4479,16 +5663,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -4512,6 +5696,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -4523,23 +5719,23 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2018_04_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2018_04_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2018_04_01.models.DataDiskImage] + :vartype plan: ~azure.mgmt.compute.v2018_04_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2018_04_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2018_04_01.models.DataDiskImage] """ _validation = { @@ -4569,6 +5765,25 @@ def __init__( data_disk_images: Optional[List["DataDiskImage"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2018_04_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2018_04_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2018_04_01.models.DataDiskImage] + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -4578,35 +5793,35 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2018_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2018_04_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2018_04_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_04_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -4641,6 +5856,37 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2018_04_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_04_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -4661,11 +5907,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2018_04_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4684,6 +5930,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4702,47 +5955,46 @@ class VirtualMachineScaleSet(Resource): :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.v2018_04_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :ivar 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.v2018_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2018_04_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: 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, + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool - :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2018_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource """ _validation = { @@ -4793,6 +6045,45 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -4814,30 +6105,30 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2018_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -4868,6 +6159,33 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -4885,26 +6203,26 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: str - :param force_update_tag: If a value is provided and is different from the previous value, the + :ivar name: The name of the extension. + :vartype name: str + :ivar 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: 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str """ @@ -4940,6 +6258,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.force_update_tag = force_update_tag @@ -4957,11 +6297,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2018_04_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4980,6 +6320,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4988,8 +6335,9 @@ def __init__( 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.v2018_04_01.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -5002,6 +6350,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -5017,16 +6370,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2018_04_01.models.ResourceIdentityType - :param identity_ids: The list of user identities associated with the virtual machine scale set. + :vartype type: str or ~azure.mgmt.compute.v2018_04_01.models.ResourceIdentityType + :ivar identity_ids: The list of user identities associated with the virtual machine scale set. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. - :type identity_ids: list[str] + :vartype identity_ids: list[str] """ _validation = { @@ -5048,6 +6401,18 @@ def __init__( identity_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2018_04_01.models.ResourceIdentityType + :keyword identity_ids: The list of user identities associated with the virtual machine scale + set. The user identity references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. + :paramtype identity_ids: list[str] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -5066,8 +6431,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] """ _validation = { @@ -5087,6 +6452,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -5115,6 +6484,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -5124,36 +6495,37 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2018_04_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2018_04_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2018_04_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2018_04_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :ivar 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 load balancer. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :ivar 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 load balancer. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_04_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] """ _validation = { @@ -5186,6 +6558,39 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2018_04_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2018_04_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -5200,10 +6605,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -5218,6 +6623,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -5228,11 +6639,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2018_04_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2018_04_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5251,6 +6663,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2018_04_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5261,11 +6681,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2018_04_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5284,6 +6704,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5294,11 +6721,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2018_04_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5317,6 +6744,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5327,11 +6761,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2018_04_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5350,6 +6784,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5358,11 +6799,12 @@ def __init__( 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. Managed - OS disk storage account type can only be set when you create the scale set. Possible values - are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: "Standard_LRS", + :ivar storage_account_type: 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. Possible values are: + Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes """ _attribute_map = { @@ -5375,6 +6817,14 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values + are: Standard_LRS, Premium_LRS, and StandardSSD_LRS. Possible values include: "Standard_LRS", + "Premium_LRS", "StandardSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_04_01.models.StorageAccountTypes + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type @@ -5384,26 +6834,26 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -5434,6 +6884,28 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -5447,8 +6919,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -5461,6 +6933,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -5468,12 +6944,12 @@ def __init__( 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 + :ivar 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.v2018_04_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2018_04_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -5489,6 +6965,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2018_04_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -5499,40 +6984,40 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2018_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_04_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2018_04_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -5566,6 +7051,43 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_04_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_04_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -5581,25 +7103,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -5614,27 +7135,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration + :ivar 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.v2018_04_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.v2018_04_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] """ _attribute_map = { @@ -5659,6 +7180,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -5674,15 +7251,15 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIpTag] + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIpTag] """ _validation = { @@ -5705,6 +7282,17 @@ def __init__( ip_tags: Optional[List["VirtualMachineScaleSetIpTag"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIpTag] + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -5717,10 +7305,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -5737,6 +7325,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -5770,6 +7364,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -5811,6 +7407,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -5821,21 +7419,22 @@ def __init__( 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 + :ivar 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.v2018_04_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageReference + :ivar 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.v2018_04_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2018_04_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -5852,6 +7451,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5861,31 +7478,30 @@ def __init__( 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.v2018_04_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2018_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: bool - :param single_placement_group: When true this limits the scale set to a single placement group, + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 proximity_placement_group: Specifies information about the proximity placement group - that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum + :vartype single_placement_group: bool + :ivar 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.v2018_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource """ _attribute_map = { @@ -5914,6 +7530,33 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2018_04_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2018_04_01.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -5928,31 +7571,31 @@ def __init__( class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): """Describes a virtual machine scale set network profile's IP configuration. - :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.v2018_04_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2018_04_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2018_04_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2018_04_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2018_04_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.SubResource] """ _attribute_map = { @@ -5981,6 +7624,34 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2018_04_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2018_04_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2018_04_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -5995,25 +7666,25 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -6040,6 +7711,27 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -6053,8 +7745,8 @@ def __init__( class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -6068,6 +7760,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -6075,23 +7772,23 @@ def __init__( 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.v2018_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2018_04_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: + :vartype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -6115,6 +7812,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2018_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_04_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -6127,14 +7844,14 @@ def __init__( 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.v2018_04_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] """ _attribute_map = { @@ -6153,6 +7870,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_04_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_04_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2018_04_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -6163,12 +7890,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -6186,6 +7913,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -6195,12 +7931,13 @@ def __init__( 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.v2018_04_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -6217,6 +7954,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2018_04_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -6226,21 +7972,22 @@ def __init__( 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.v2018_04_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str """ _attribute_map = { @@ -6263,6 +8010,24 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -6285,20 +8050,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2018_04_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2018_04_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -6311,18 +8076,18 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :ivar 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 @@ -6332,10 +8097,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2018_04_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2018_04_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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6343,7 +8108,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -6400,6 +8165,49 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -6445,6 +8253,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -6453,10 +8263,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -6469,6 +8279,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -6478,8 +8294,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -6496,6 +8312,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -6505,34 +8325,34 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2018_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2018_04_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2018_04_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_04_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -6568,6 +8388,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2018_04_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2018_04_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_04_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_04_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -6587,11 +8435,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6610,6 +8458,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6618,24 +8473,24 @@ def __init__( 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.v2018_04_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6643,15 +8498,15 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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. + :vartype license_type: str + :ivar 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". - :type priority: str or ~azure.mgmt.compute.v2018_04_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority + :vartype priority: str or ~azure.mgmt.compute.v2018_04_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or + :vartype eviction_policy: str or ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineEvictionPolicyTypes """ @@ -6679,6 +8534,43 @@ def __init__( eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2018_04_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for virtual machines in a low priority + scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values + include: "Deallocate", "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineEvictionPolicyTypes + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -6693,20 +8585,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -6729,6 +8621,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -6741,8 +8649,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSize] """ _attribute_map = { @@ -6755,6 +8663,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -6784,6 +8696,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -6794,30 +8708,30 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_04_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :ivar 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 @@ -6827,16 +8741,16 @@ class VirtualMachineUpdate(UpdateResource): `_ :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.v2018_04_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: + :vartype availability_set: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :ivar 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.v2018_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_04_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.v2018_04_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6844,7 +8758,7 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -6891,6 +8805,55 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_04_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_04_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_04_01.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_04_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_04_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_04_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_04_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -6911,23 +8874,23 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2018_04_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2018_04_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2018_04_01.models.WinRMConfiguration """ _attribute_map = { @@ -6948,6 +8911,26 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + updates. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2018_04_01.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2018_04_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -6959,8 +8942,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2018_04_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2018_04_01.models.WinRMListener] """ _attribute_map = { @@ -6973,6 +8956,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2018_04_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -6980,18 +8967,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2018_04_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2018_04_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -7006,6 +8993,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2018_04_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py index 4ef10196fc5d..66968231f8e4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2018_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2018_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py index 73fdb12b9837..b5e3950921a4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2018_04_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2018_04_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2018-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2018-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py index 5529e69f6603..0da8f2ac470c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py index b03b2c3fe005..517cd1e6ce79 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_04_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py index 26763cb96dc2..1cc59ca62a67 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2018_04_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py index 4a42b4fb7f8b..9ea263bbc1b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,242 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +264,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +290,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +323,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +353,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +382,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +409,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,13 +432,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -260,27 +456,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,18 +480,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2018_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -313,34 +503,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -358,24 +543,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -383,35 +571,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +613,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py index b120d227d8b9..7ec89d09136e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2018_04_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2018-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2018-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py index 1b67da073082..009f6cbfb2df 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py index f77ab6fd2ace..1ac5371e5cd1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2018_04_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extensions_operations.py index ba425c162acc..51f16f88cda2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2018_04_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_images_operations.py index 3755c2dbe129..12cfc2ae3d3c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2018_04_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_run_commands_operations.py index d8e657facc16..f4b968cd8886 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_04_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py index 52eb3ce64d9a..a18d6592303b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +205,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +250,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +274,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +304,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,41 +330,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - vmss_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,14 +369,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -249,15 +388,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -272,22 +413,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -299,17 +432,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -330,30 +464,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,15 +490,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -383,8 +508,10 @@ def list( :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.v2018_04_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -392,36 +519,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +563,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index bf99e87fd193..4ed172a675bf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,119 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +143,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +175,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +191,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +215,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +234,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +271,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +289,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +313,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,15 +332,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -287,27 +358,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -321,4 +382,6 @@ def get_latest( 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/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py index d0219e46f8da..e374f763ff12 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,518 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,37 +542,28 @@ def __init__(self, client, config, serializer, deserializer): def _reimage_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-01" - - # 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] + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -92,14 +576,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -110,15 +595,17 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -133,22 +620,14 @@ def begin_reimage( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -160,41 +639,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -207,14 +678,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -226,15 +698,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -249,22 +723,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -276,41 +742,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,14 +781,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -343,15 +802,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -366,22 +827,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -393,49 +846,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -453,17 +896,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -477,15 +922,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -498,28 +948,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,41 +974,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -578,14 +1013,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -596,15 +1032,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -619,22 +1057,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -646,16 +1076,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -674,28 +1105,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -709,16 +1130,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -737,28 +1160,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -772,18 +1185,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -800,8 +1215,10 @@ def list( '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.v2018_04_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -809,42 +1226,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -862,6 +1276,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -869,37 +1284,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -912,14 +1318,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -932,15 +1339,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -955,22 +1364,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -982,41 +1383,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1029,14 +1422,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1047,15 +1441,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1070,22 +1466,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1097,41 +1485,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1144,14 +1524,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1162,15 +1543,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1185,22 +1568,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1212,41 +1587,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1259,14 +1626,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1278,15 +1646,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1301,22 +1671,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1328,41 +1690,33 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1375,14 +1729,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1393,15 +1748,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1416,22 +1773,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1443,49 +1792,39 @@ def get_long_running_output(pipeline_response): ) 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 _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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1501,17 +1840,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1524,15 +1865,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2018_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1545,28 +1890,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1578,4 +1916,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py index f97479cbec7d..db8e87e73818 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,807 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +831,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +874,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +896,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +921,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +947,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +991,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1013,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1038,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,39 +1064,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,13 +1101,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -361,15 +1117,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +1141,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -409,15 +1160,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -434,27 +1186,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,48 +1210,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,14 +1257,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -539,18 +1275,22 @@ def begin_deallocate( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,24 +1302,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,45 +1325,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -642,14 +1368,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -657,18 +1384,22 @@ def begin_delete_instances( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -680,24 +1411,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -709,15 +1434,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -734,27 +1460,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -768,21 +1484,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_04_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -790,35 +1510,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,23 +1552,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2018_04_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -860,34 +1579,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,18 +1619,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -925,8 +1640,10 @@ def list_skus( :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.v2018_04_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -934,36 +1651,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -981,18 +1695,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1000,8 +1715,10 @@ def get_os_upgrade_history( :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.v2018_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1009,36 +1726,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,6 +1770,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1063,44 +1778,35 @@ def get_next(next_link=None): def _power_off_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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1113,14 +1819,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1130,18 +1837,22 @@ def begin_power_off( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1153,24 +1864,18 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1182,48 +1887,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1236,14 +1933,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1251,18 +1949,22 @@ def begin_restart( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1274,24 +1976,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1303,48 +1999,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1357,14 +2045,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1372,18 +2061,22 @@ def begin_start( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1395,24 +2088,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1424,48 +2111,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1478,14 +2157,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1494,18 +2174,22 @@ def begin_redeploy( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1517,24 +2201,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1546,48 +2224,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1600,14 +2270,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1618,18 +2289,22 @@ def begin_perform_maintenance( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1641,24 +2316,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1670,45 +2339,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1721,14 +2382,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1736,18 +2398,22 @@ def begin_update_instances( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1759,24 +2425,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1788,48 +2448,40 @@ def get_long_running_output(pipeline_response): ) 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_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1842,14 +2494,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1857,18 +2510,22 @@ def begin_reimage( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1880,24 +2537,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1909,48 +2560,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1963,14 +2606,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1979,18 +2623,22 @@ def begin_reimage_all( :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2002,24 +2650,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2031,16 +2673,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2061,28 +2704,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2096,4 +2729,6 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py index 5f8ab2ed45f6..cd3b8ee70b2a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,19 +80,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes for a subscription in a location. :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.v2018_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -65,35 +102,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py index 38aabbfa76d0..8c62fa904047 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py @@ -5,25 +5,671 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +693,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +715,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +757,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +765,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +806,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +829,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_04_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +854,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +880,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +928,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -323,15 +950,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2018_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -343,27 +974,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -375,47 +1000,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -433,16 +1048,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -453,15 +1070,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2018_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -473,27 +1094,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -505,39 +1120,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,13 +1157,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -565,15 +1173,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -587,21 +1197,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,23 +1216,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -641,29 +1246,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,15 +1271,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -702,27 +1298,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -736,39 +1322,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,13 +1360,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -797,15 +1377,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -819,21 +1401,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -845,39 +1420,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -890,13 +1457,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -906,15 +1474,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -928,21 +1498,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -954,15 +1517,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -979,25 +1543,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1010,20 +1566,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1031,35 +1590,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1077,22 +1632,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2018_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1100,34 +1658,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1145,18 +1698,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1165,8 +1719,10 @@ def list_available_sizes( :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.v2018_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1174,36 +1730,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1221,6 +1774,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1228,35 +1782,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1269,13 +1814,14 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1285,15 +1831,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,21 +1855,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1333,39 +1874,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1378,13 +1911,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1393,15 +1927,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1415,21 +1951,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1441,39 +1970,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1486,13 +2007,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1501,15 +2023,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1523,21 +2047,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1549,39 +2066,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1594,13 +2103,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1609,15 +2119,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1631,21 +2143,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1657,39 +2162,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1702,13 +2199,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -1717,15 +2215,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1739,21 +2239,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1765,47 +2258,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2018-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1821,16 +2304,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -1841,15 +2326,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2018_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1861,27 +2350,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1893,4 +2376,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py index ba4eb57001ab..720217d8019b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py @@ -6,174 +6,153 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, GalleriesOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2018_06_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2018_06_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2018_06_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2018_06_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2018_06_01.operations.ProximityPlacementGroupsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2018_06_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2018_06_01.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2018_06_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2018_06_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2018_06_01.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2018_06_01.operations.VirtualMachineRunCommandsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2018_06_01.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2018_06_01.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2018_06_01.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2018_06_01.operations.GalleryImageVersionsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2018_06_01.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2018_06_01.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py index 53f2bbe2598e..17c3fdcd80a7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json index c7b04b3e9c7f..bdea49071c50 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py index 1d384255611a..cd064921d935 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py @@ -6,170 +6,154 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DisksOperations, GalleriesOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2018_06_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2018_06_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2018_06_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2018_06_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2018_06_01.aio.operations.ProximityPlacementGroupsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2018_06_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2018_06_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2018_06_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2018_06_01.aio.operations.VirtualMachineRunCommandsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2018_06_01.aio.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2018_06_01.aio.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2018_06_01.aio.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2018_06_01.aio.operations.GalleryImageVersionsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2018_06_01.aio.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2018_06_01.aio.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py index 2a81d224562c..7bd2f6908d49 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py index 189c143df412..7ccd2a7a1e58 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2018_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2018_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2018_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py index e034f43f96c7..d4cfe5014986 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2018_06_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2018_06_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_06_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py index 9e3798ff7a05..d230c4eaaaf9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._galleries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,19 @@ async def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2018_06_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,8 +169,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -197,27 +195,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +219,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -244,27 +234,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -277,6 +257,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -291,15 +273,17 @@ async def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,21 +297,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,8 +316,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -352,7 +331,8 @@ def list_by_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 GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -360,35 +340,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -406,11 +382,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -419,7 +397,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -427,34 +406,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -472,6 +446,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py index ff05b21925e7..4ae1bfaf60d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_image_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_image_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -136,15 +134,20 @@ async def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +161,21 @@ async def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,8 +187,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -227,31 +224,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -265,8 +251,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -280,29 +268,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -315,6 +293,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -337,15 +317,17 @@ async def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -361,23 +343,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -389,8 +362,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, resource_group_name: str, @@ -409,8 +384,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -418,37 +395,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -466,6 +441,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py index 193d856738e2..a7d3e03f096f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -128,15 +126,19 @@ async def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2018_06_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +151,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -182,8 +177,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -210,28 +207,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -245,8 +232,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -259,28 +248,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,6 +272,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -311,15 +292,17 @@ async def begin_delete( :type gallery_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -334,22 +317,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -361,8 +336,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -378,7 +355,8 @@ def list_by_gallery( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] @@ -386,36 +364,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -433,6 +408,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py index f2be7fc8b6b6..4e4e0e594a2a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2018_06_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2018_06_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py index ae1d6cd3a269..da066a7bc75a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_06_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py index d4793e6ff717..e802a452fe23 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2018_06_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py index b5a63b127baf..44f3e669f066 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -252,27 +238,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -286,8 +262,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -295,8 +274,10 @@ def list_by_subscription( """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.v2018_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -304,34 +285,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -349,11 +325,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -364,8 +342,10 @@ def list_by_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.v2018_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -373,35 +353,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +395,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py index 886c1cfa9605..3665216521b7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_06_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py index 3097276585df..27f3fbce0efe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2018_06_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py index 0c35459ba42b..2b46f707ae8c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py index b38d538ae328..7eb487c95f0b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2018_06_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_images_operations.py index 2c70e0a089ed..a7d04265f9fe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py index 330ef59280b0..06cd3ffeb3dd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2018_06_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index fd5c668cd975..fa5e88150320 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -192,26 +190,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -224,6 +214,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -241,15 +233,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -264,22 +258,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -291,8 +277,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -321,30 +309,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -358,8 +335,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -373,8 +353,10 @@ def list( :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.v2018_06_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -382,36 +364,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +408,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index c3e17e02e39b..77ea0364a6c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index f4aa27d305dc..2c19b9063075 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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.v2018_06_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -546,26 +513,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -578,6 +537,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -595,15 +556,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -618,22 +581,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -645,8 +600,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -672,28 +629,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -707,8 +654,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -734,28 +684,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -769,8 +709,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -796,8 +739,10 @@ def list( '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.v2018_06_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -805,42 +750,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -858,6 +800,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -875,26 +818,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -907,6 +842,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -926,15 +863,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -949,22 +888,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -976,6 +907,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -990,26 +922,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1022,6 +946,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1039,15 +965,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1062,22 +990,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1089,6 +1009,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1103,26 +1024,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1135,6 +1048,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1152,15 +1067,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1175,22 +1092,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1202,6 +1111,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1216,26 +1126,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1248,6 +1150,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1266,15 +1170,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1289,22 +1195,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1316,6 +1214,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1330,26 +1229,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1362,6 +1253,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1379,15 +1272,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1402,22 +1297,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1429,6 +1316,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1444,33 +1332,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1486,8 +1364,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1508,15 +1389,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1529,28 +1415,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1562,4 +1441,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py index 2513a79ae2ff..162cfde0c5e5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -337,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -351,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -399,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -423,27 +405,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -457,8 +429,10 @@ async def get( 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, @@ -471,33 +445,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,6 +476,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -526,18 +494,22 @@ async def begin_deallocate( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,24 +521,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -578,6 +544,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -592,30 +559,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -628,6 +587,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -642,18 +603,22 @@ async def begin_delete_instances( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -665,24 +630,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -694,8 +653,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -718,27 +679,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -752,8 +703,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -764,8 +718,10 @@ def list( :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.v2018_06_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -773,35 +729,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -819,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -833,8 +787,10 @@ def list_all( 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.v2018_06_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -842,34 +798,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -887,11 +838,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -906,8 +859,10 @@ def list_skus( :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.v2018_06_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -915,36 +870,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -962,11 +914,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -980,8 +934,10 @@ def get_os_upgrade_history( :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.v2018_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -989,36 +945,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1036,6 +989,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1053,33 +1007,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1092,6 +1038,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1108,18 +1056,22 @@ async def begin_power_off( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1131,24 +1083,18 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1160,6 +1106,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1174,33 +1121,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1213,6 +1152,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1227,18 +1168,22 @@ async def begin_restart( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1250,24 +1195,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1279,6 +1218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1293,33 +1233,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1332,6 +1264,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1346,18 +1280,22 @@ async def begin_start( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1369,24 +1307,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1398,6 +1330,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1412,33 +1345,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1451,6 +1376,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1466,18 +1393,22 @@ async def begin_redeploy( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1489,24 +1420,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1518,6 +1443,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1532,33 +1458,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1571,6 +1489,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1588,18 +1508,22 @@ async def begin_perform_maintenance( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1611,24 +1535,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1640,6 +1558,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1654,30 +1573,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1690,6 +1601,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1704,18 +1617,22 @@ async def begin_update_instances( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,24 +1644,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1756,6 +1667,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1770,33 +1682,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1809,6 +1713,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1825,18 +1731,22 @@ async def begin_reimage( :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.v2018_06_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1848,24 +1758,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1877,6 +1781,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1891,33 +1796,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1930,6 +1827,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1945,18 +1844,22 @@ async def begin_reimage_all( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1968,24 +1871,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1997,8 +1894,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2026,28 +1925,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2061,4 +1950,6 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py index a47267f3d4a7..42d0d0741d61 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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.v2018_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py index 5de57a5bd6d4..fa0bcd9917bb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2018_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -314,15 +305,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +330,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -366,6 +356,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -380,32 +371,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -423,8 +404,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,15 +426,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -462,27 +451,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,6 +477,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -507,25 +491,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +514,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -552,15 +530,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,21 +554,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,8 +573,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -615,7 +590,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -627,29 +603,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -663,8 +628,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -687,27 +655,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -721,8 +679,10 @@ async def instance_view( 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, @@ -734,25 +694,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -765,6 +717,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -780,15 +734,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -802,21 +758,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -828,6 +777,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -841,25 +791,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -872,6 +814,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -887,15 +831,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -909,21 +855,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -935,8 +874,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -959,25 +900,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -990,6 +923,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1001,8 +936,10 @@ def list( :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.v2018_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1010,35 +947,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,11 +989,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -1069,8 +1004,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2018_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1078,34 +1015,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1123,11 +1055,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1142,8 +1076,10 @@ def list_available_sizes( :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.v2018_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1151,36 +1087,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1198,6 +1131,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1214,25 +1148,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1245,6 +1171,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1260,15 +1188,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1282,21 +1212,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1308,6 +1231,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1321,25 +1245,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1352,6 +1268,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1366,15 +1284,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1388,21 +1308,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1414,6 +1327,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1427,25 +1341,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1458,6 +1364,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1472,15 +1380,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1494,21 +1404,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1520,6 +1423,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1533,25 +1437,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1564,6 +1460,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1578,15 +1476,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1600,21 +1500,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1626,6 +1519,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1640,33 +1534,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1679,6 +1565,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1696,15 +1584,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1716,24 +1607,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1745,6 +1630,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1758,25 +1644,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1789,6 +1667,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1803,15 +1683,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1825,21 +1707,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1851,6 +1726,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1865,32 +1741,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1906,8 +1772,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1925,15 +1794,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1945,27 +1819,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1977,4 +1845,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_06_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/__init__.py index afc8b980202f..89afff2c5dcc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/__init__.py @@ -6,384 +6,195 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - 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 AutoOSUpgradePolicy - from ._models_py3 import AvailabilitySet - from ._models_py3 import AvailabilitySetListResult - from ._models_py3 import AvailabilitySetUpdate - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import CreationData - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiffDiskSettings - from ._models_py3 import Disallowed - from ._models_py3 import Disk - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import EncryptionSettings - from ._models_py3 import Gallery - from ._models_py3 import GalleryArtifactPublishingProfileBase - from ._models_py3 import GalleryArtifactSource - from ._models_py3 import GalleryDataDiskImage - from ._models_py3 import GalleryDiskImage - from ._models_py3 import GalleryIdentifier - from ._models_py3 import GalleryImage - from ._models_py3 import GalleryImageIdentifier - from ._models_py3 import GalleryImageList - from ._models_py3 import GalleryImageVersion - from ._models_py3 import GalleryImageVersionList - from ._models_py3 import GalleryImageVersionPublishingProfile - from ._models_py3 import GalleryImageVersionStorageProfile - from ._models_py3 import GalleryList - from ._models_py3 import GalleryOSDiskImage - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDiskReference - from ._models_py3 import ImageListResult - from ._models_py3 import ImageOSDisk - from ._models_py3 import ImagePurchasePlan - from ._models_py3 import ImageReference - from ._models_py3 import ImageStorageProfile - from ._models_py3 import ImageUpdate - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - from ._models_py3 import LogAnalyticsInputBase - from ._models_py3 import LogAnalyticsOperationResult - from ._models_py3 import LogAnalyticsOutput - from ._models_py3 import MaintenanceRedeployStatus - from ._models_py3 import ManagedArtifact - 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 OSProfile - 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 RecommendedMachineConfiguration - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RegionalReplicationStatus - from ._models_py3 import ReplicationStatus - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - from ._models_py3 import ResourceRange - 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 Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import TargetRegion - from ._models_py3 import ThrottledRequestsInput - 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 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineReimageParameters - 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 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 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineScaleSetVMReimageParameters - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - 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 -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - 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 AutoOSUpgradePolicy # type: ignore - from ._models import AvailabilitySet # type: ignore - from ._models import AvailabilitySetListResult # type: ignore - from ._models import AvailabilitySetUpdate # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeOperationListResult # type: ignore - from ._models import ComputeOperationValue # type: ignore - from ._models import CreationData # type: ignore - from ._models import DataDisk # type: ignore - from ._models import DataDiskImage # type: ignore - from ._models import DiagnosticsProfile # type: ignore - from ._models import DiffDiskSettings # type: ignore - from ._models import Disallowed # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import EncryptionSettings # type: ignore - from ._models import Gallery # type: ignore - from ._models import GalleryArtifactPublishingProfileBase # type: ignore - from ._models import GalleryArtifactSource # type: ignore - from ._models import GalleryDataDiskImage # type: ignore - from ._models import GalleryDiskImage # type: ignore - from ._models import GalleryIdentifier # type: ignore - from ._models import GalleryImage # type: ignore - from ._models import GalleryImageIdentifier # type: ignore - from ._models import GalleryImageList # type: ignore - from ._models import GalleryImageVersion # type: ignore - from ._models import GalleryImageVersionList # type: ignore - from ._models import GalleryImageVersionPublishingProfile # type: ignore - from ._models import GalleryImageVersionStorageProfile # type: ignore - from ._models import GalleryList # type: ignore - from ._models import GalleryOSDiskImage # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import Image # type: ignore - from ._models import ImageDataDisk # type: ignore - from ._models import ImageDiskReference # type: ignore - from ._models import ImageListResult # type: ignore - from ._models import ImageOSDisk # type: ignore - from ._models import ImagePurchasePlan # 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 InstanceViewStatus # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 ManagedArtifact # 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 OSProfile # 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 RecommendedMachineConfiguration # type: ignore - from ._models import RecoveryWalkResponse # type: ignore - from ._models import RegionalReplicationStatus # type: ignore - from ._models import ReplicationStatus # type: ignore - from ._models import RequestRateByIntervalInput # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRange # 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 Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import TargetRegion # type: ignore - from ._models import ThrottledRequestsInput # 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 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineReimageParameters # 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 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 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineScaleSetVMReimageParameters # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # 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_py3 import AccessUri +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 AutoOSUpgradePolicy +from ._models_py3 import AvailabilitySet +from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import AvailabilitySetUpdate +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import CreationData +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiffDiskSettings +from ._models_py3 import Disallowed +from ._models_py3 import Disk +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import EncryptionSettings +from ._models_py3 import Gallery +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryIdentifier +from ._models_py3 import GalleryImage +from ._models_py3 import GalleryImageIdentifier +from ._models_py3 import GalleryImageList +from ._models_py3 import GalleryImageVersion +from ._models_py3 import GalleryImageVersionList +from ._models_py3 import GalleryImageVersionPublishingProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryList +from ._models_py3 import GalleryOSDiskImage +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDiskReference +from ._models_py3 import ImageListResult +from ._models_py3 import ImageOSDisk +from ._models_py3 import ImagePurchasePlan +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import ImageUpdate +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +from ._models_py3 import LogAnalyticsInputBase +from ._models_py3 import LogAnalyticsOperationResult +from ._models_py3 import LogAnalyticsOutput +from ._models_py3 import MaintenanceRedeployStatus +from ._models_py3 import ManagedArtifact +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 OSProfile +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 RecommendedMachineConfiguration +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RegionalReplicationStatus +from ._models_py3 import ReplicationStatus +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceRange +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 Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import TargetRegion +from ._models_py3 import ThrottledRequestsInput +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 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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineReimageParameters +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 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 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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineScaleSetVMReimageParameters +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +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 ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_compute_management_client_enums.py index ca7cbc2532ea..75a0432d3f90 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_compute_management_client_enums.py @@ -6,32 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" -class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the aggregated replication status based on all the regional replication status flags. """ @@ -40,7 +25,7 @@ class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, E COMPLETED = "Completed" FAILED = "Failed" -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -48,7 +33,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -59,13 +44,13 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiffDiskOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the ephemeral disk option for operating system disk. """ LOCAL = "Local" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -76,7 +61,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COPY = "Copy" RESTORE = "Restore" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -89,7 +74,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -98,7 +83,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImagePropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -109,7 +94,7 @@ class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImageVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -120,7 +105,7 @@ class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensi DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -131,7 +116,7 @@ class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta DELETING = "Deleting" MIGRATING = "Migrating" -class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' """ @@ -139,7 +124,7 @@ class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -148,7 +133,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -157,7 +142,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -166,21 +151,21 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ GENERALIZED = "Generalized" SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -188,7 +173,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -197,7 +182,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the regional replication state. """ @@ -206,11 +191,11 @@ class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAILED = "Failed" -class ReplicationStatusTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationStatusTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REPLICATION_STATUS = "ReplicationStatus" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -221,14 +206,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -237,7 +222,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -245,7 +230,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -253,7 +238,7 @@ class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, PREMIUM_LRS = "Premium_LRS" STANDARD_ZRS = "Standard_ZRS" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -261,7 +246,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. """ @@ -271,7 +256,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -283,7 +268,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -291,7 +276,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -300,7 +285,7 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineEvictionPolicyTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -308,7 +293,7 @@ class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, DEALLOCATE = "Deallocate" DELETE = "Delete" -class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachinePriorityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the priority for the virtual machines in the scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -316,14 +301,14 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, REGULAR = "Regular" LOW = "Low" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_models.py deleted file mode 100644 index ec222c04dca3..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_models.py +++ /dev/null @@ -1,7417 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2018_06_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2018_06_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2018_06_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class AutoOSUpgradePolicy(msrest.serialization.Model): - """The configuration parameters used for performing automatic OS upgrade. - - :param disable_auto_rollback: Whether OS image rollback feature should be disabled. Default - value is false. - :type disable_auto_rollback: bool - """ - - _attribute_map = { - 'disable_auto_rollback': {'key': 'disableAutoRollback', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoOSUpgradePolicy, self).__init__(**kwargs) - self.disable_auto_rollback = kwargs.get('disable_auto_rollback', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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.v2018_06_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.v2018_06_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.v2018_06_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2018_06_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2018_06_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, - **kwargs - ): - 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 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux serial console log blob Uri. - :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.v2018_06_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 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.v2018_06_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 CreationData(msrest.serialization.Model): - """Data used when creating a disk. - - All required parameters must be populated in order to send to Azure. - - :param create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". - :type create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of - the storage account containing the blob to import as a disk. Required only if the blob is in a - different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - """ - - _validation = { - 'create_option': {'required': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - - -class DataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.ManagedDiskParameters - """ - - _validation = { - 'lun': {'required': True}, - 'create_option': {'required': 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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 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.v2018_06_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.v2018_06_01.models.DiffDiskOptions - """ - - _attribute_map = { - 'option': {'key': 'option', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiffDiskSettings, self).__init__(**kwargs) - self.option = kwargs.get('option', None) - - -class Disallowed(msrest.serialization.Model): - """Describes the disallowed disk types. - - :param disk_types: A list of disk types. - :type disk_types: list[str] - """ - - _attribute_map = { - 'disk_types': {'key': 'diskTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Disallowed, self).__init__(**kwargs) - self.disk_types = kwargs.get('disk_types', None) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. For a description of the - range of values you can set, see `Ultra SSD Managed Disk Offerings - `_. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. For a description of the range of values you can set, see `Ultra SSD Managed Disk Offerings - `_. - :type disk_m_bps_read_write: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.provisioning_state = 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 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.v2018_06_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.v2018_06_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.v2018_06_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_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 DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2018_06_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: int - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', 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 EncryptionSettings(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettings, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class Gallery(Resource): - """Specifies information about the Shared Image Gallery that you want to create or update. - - 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 description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2018_06_01.models.GalleryPropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Gallery, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - - -class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): - """Describes the basic gallery artifact publishing profile. - - All required parameters must be populated in order to send to Azure. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource - """ - - _validation = { - 'source': {'required': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) - self.target_regions = kwargs.get('target_regions', None) - self.source = kwargs['source'] - - -class GalleryArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2018_06_01.models.ManagedArtifact - """ - - _validation = { - 'managed_image': {'required': True}, - } - - _attribute_map = { - 'managed_image': {'key': 'managedImage', 'type': 'ManagedArtifact'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactSource, self).__init__(**kwargs) - self.managed_image = kwargs['managed_image'] - - -class GalleryDiskImage(msrest.serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.v2018_06_01.models.HostCaching - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'host_caching': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDiskImage, self).__init__(**kwargs) - self.size_in_gb = None - self.host_caching = None - - -class GalleryDataDiskImage(GalleryDiskImage): - """This is the data disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.v2018_06_01.models.HostCaching - :ivar lun: This property specifies the logical unit number of the data disk. This value is used - to identify data disks within the Virtual Machine and therefore must be unique for each data - disk attached to the Virtual Machine. - :vartype lun: int - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'host_caching': {'readonly': True}, - 'lun': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDataDiskImage, self).__init__(**kwargs) - self.lun = None - - -class GalleryIdentifier(msrest.serialization.Model): - """Describes the gallery unique name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated - automatically by Azure. - :vartype unique_name: str - """ - - _validation = { - 'unique_name': {'readonly': True}, - } - - _attribute_map = { - 'unique_name': {'key': 'uniqueName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryIdentifier, self).__init__(**kwargs) - self.unique_name = None - - -class GalleryImage(Resource): - """Specifies information about the gallery Image Definition that you want to create or update. - - 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 description: The description of this gallery Image Definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2018_06_01.models.OperatingSystemTypes - :param os_state: The allowed values for OS State are 'Generalized'. Possible values include: - "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2018_06_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2018_06_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2018_06_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2018_06_01.models.GalleryImagePropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImage, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageIdentifier(msrest.serialization.Model): - """This is the gallery Image Definition identifier. - - All required parameters must be populated in order to send to Azure. - - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str - """ - - _validation = { - 'publisher': {'required': True}, - 'offer': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageIdentifier, self).__init__(**kwargs) - self.publisher = kwargs['publisher'] - self.offer = kwargs['offer'] - self.sku = kwargs['sku'] - - -class GalleryImageList(msrest.serialization.Model): - """The List Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersion(Resource): - """Specifies information about the gallery Image Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionPropertiesProvisioningState - :ivar storage_profile: This is the storage profile of a gallery Image Version. - :vartype storage_profile: - ~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2018_06_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'storage_profile': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = None - self.replication_status = None - - -class GalleryImageVersionList(msrest.serialization.Model): - """The List Gallery Image version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. - - 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 target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - """ - - _validation = { - 'source': {'required': True}, - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactSource'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionPublishingProfile, self).__init__(**kwargs) - self.replica_count = kwargs.get('replica_count', None) - self.exclude_from_latest = kwargs.get('exclude_from_latest', None) - self.published_date = None - self.end_of_life_date = kwargs.get('end_of_life_date', None) - - -class GalleryImageVersionStorageProfile(msrest.serialization.Model): - """This is the storage profile of a gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar os_disk_image: This is the OS disk image. - :vartype os_disk_image: ~azure.mgmt.compute.v2018_06_01.models.GalleryOSDiskImage - :ivar data_disk_images: A list of data disk images. - :vartype data_disk_images: list[~azure.mgmt.compute.v2018_06_01.models.GalleryDataDiskImage] - """ - - _validation = { - 'os_disk_image': {'readonly': True}, - 'data_disk_images': {'readonly': True}, - } - - _attribute_map = { - 'os_disk_image': {'key': 'osDiskImage', 'type': 'GalleryOSDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[GalleryDataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) - self.os_disk_image = None - self.data_disk_images = None - - -class GalleryList(msrest.serialization.Model): - """The List Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Gallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.v2018_06_01.models.HostCaching - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'host_caching': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryOSDiskImage, self).__init__(**kwargs) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2018_06_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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.v2018_06_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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}'}, - 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Image, 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 - - -class ImageDataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_06_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.v2018_06_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - 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) - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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.v2018_06_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(msrest.serialization.Model): - """Describes an Operating System disk. - - All required parameters must be populated in order to send to Azure. - - :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.v2018_06_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_06_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.v2018_06_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. - UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes - """ - - _validation = { - 'os_type': {'required': True}, - 'os_state': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_state': {'key': 'osState', 'type': 'str'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageOSDisk, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.os_state = kwargs['os_state'] - 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) - - -class ImagePurchasePlan(msrest.serialization.Model): - """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImagePurchasePlan, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.publisher = kwargs.get('publisher', None) - self.product = kwargs.get('product', 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 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. - - :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 - """ - - _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'}, - } - - 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) - - -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.v2018_06_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.v2018_06_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.v2018_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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'}, - } - - 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 - - -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 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.v2018_06_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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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.v2018_06_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.v2018_06_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 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.v2018_06_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 - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, - } - - 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) - - -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.v2018_06_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 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 - """ - - _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'}, - } - - 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) - - -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.v2018_06_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.v2018_06_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 ManagedArtifact(msrest.serialization.Model): - """The managed artifact. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The managed artifact id. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedArtifact, self).__init__(**kwargs) - self.id = kwargs['id'] - - -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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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.v2018_06_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 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.v2018_06_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.v2018_06_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2018_06_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.v2018_06_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2018_06_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 - """ - - _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'}, - } - - 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) - - -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.v2018_06_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.v2018_06_01.models.SubResource] - :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.v2018_06_01.models.SubResource] - :ivar availability_sets: A list of references to all availability sets in the proximity - placement group. - :vartype availability_sets: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] - """ - - _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': '[SubResource]'}, - 'virtual_machine_scale_sets': {'key': 'properties.virtualMachineScaleSets', 'type': '[SubResource]'}, - 'availability_sets': {'key': 'properties.availabilitySets', 'type': '[SubResource]'}, - } - - 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 - - -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.v2018_06_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 RecommendedMachineConfiguration(msrest.serialization.Model): - """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange - """ - - _attribute_map = { - 'v_cp_us': {'key': 'vCPUs', 'type': 'ResourceRange'}, - 'memory': {'key': 'memory', 'type': 'ResourceRange'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedMachineConfiguration, self).__init__(**kwargs) - self.v_cp_us = kwargs.get('v_cp_us', None) - self.memory = kwargs.get('memory', None) - - -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 RegionalReplicationStatus(msrest.serialization.Model): - """This is the regional replication status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: The region to which the gallery Image Version is being replicated to. - :vartype region: str - :ivar state: This is the regional replication state. Possible values include: "Unknown", - "Replicating", "Completed", "Failed". - :vartype state: str or ~azure.mgmt.compute.v2018_06_01.models.ReplicationState - :ivar details: The details of the replication status. - :vartype details: str - :ivar progress: It indicates progress of the replication job. - :vartype progress: int - """ - - _validation = { - 'region': {'readonly': True}, - 'state': {'readonly': True}, - 'details': {'readonly': True}, - 'progress': {'readonly': True}, - } - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalReplicationStatus, self).__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None - - -class ReplicationStatus(msrest.serialization.Model): - """This is the replication status of the gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: This is the aggregated replication status based on all the regional - replication status flags. Possible values include: "Unknown", "InProgress", "Completed", - "Failed". - :vartype aggregated_state: str or - ~azure.mgmt.compute.v2018_06_01.models.AggregatedReplicationState - :ivar summary: This is a summary of replication status for each region. - :vartype summary: list[~azure.mgmt.compute.v2018_06_01.models.RegionalReplicationStatus] - """ - - _validation = { - 'aggregated_state': {'readonly': True}, - 'summary': {'readonly': True}, - } - - _attribute_map = { - 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': '[RegionalReplicationStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationStatus, self).__init__(**kwargs) - self.aggregated_state = None - self.summary = 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 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.v2018_06_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'}, - 'interval_length': {'key': 'intervalLength', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RequestRateByIntervalInput, self).__init__(**kwargs) - self.interval_length = kwargs['interval_length'] - - -class ResourceRange(msrest.serialization.Model): - """Describes the resource range. - - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int - """ - - _attribute_map = { - 'min': {'key': 'min', 'type': 'int'}, - 'max': {'key': 'max', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRange, self).__init__(**kwargs) - self.min = kwargs.get('min', None) - self.max = kwargs.get('max', 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.v2018_06_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 - """ - - _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'}, - } - - 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) - - -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.v2018_06_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.v2018_06_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.v2018_06_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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 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 Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.provisioning_state = None - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2018_06_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'EncryptionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', 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.v2018_06_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 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.v2018_06_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.v2018_06_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.v2018_06_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 TargetRegion(msrest.serialization.Model): - """Describes the target region information. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :type regional_replica_count: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'regional_replica_count': {'key': 'regionalReplicaCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetRegion, self).__init__(**kwargs) - self.name = kwargs['name'] - self.regional_replica_count = kwargs.get('regional_replica_count', 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ThrottledRequestsInput, self).__init__(**kwargs) - - -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.v2018_06_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.v2018_06_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set - instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool - :param auto_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.AutoOSUpgradePolicy - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'rolling_upgrade_policy': {'key': 'rollingUpgradePolicy', 'type': 'RollingUpgradePolicy'}, - 'automatic_os_upgrade': {'key': 'automaticOSUpgrade', 'type': 'bool'}, - 'auto_os_upgrade_policy': {'key': 'autoOSUpgradePolicy', 'type': 'AutoOSUpgradePolicy'}, - } - - 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 = kwargs.get('automatic_os_upgrade', None) - self.auto_os_upgrade_policy = kwargs.get('auto_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: An enum describing the unit of usage measurement. Has constant 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.v2018_06_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.v2018_06_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - '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'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, - 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', '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'}, - } - - 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.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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.proximity_placement_group = kwargs.get('proximity_placement_group', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2018_06_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_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 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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2018_06_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'}, - '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.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.v2018_06_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.v2018_06_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_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.v2018_06_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2018_06_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.v2018_06_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.v2018_06_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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2018_06_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2018_06_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2018_06_01.models.DataDiskImage] - """ - - _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}'}, - 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2018_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2018_06_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView] - :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.v2018_06_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] - """ - - _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'}, - '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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2018_06_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 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 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.v2018_06_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.v2018_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2018_06_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 - :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. - :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.v2018_06_01.models.SubResource - """ - - _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]'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'overprovision': {'key': 'properties.overprovision', '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'}, - } - - 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.upgrade_policy = kwargs.get('upgrade_policy', None) - self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.provisioning_state = None - self.overprovision = kwargs.get('overprovision', 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) - - -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.v2018_06_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.v2018_06_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.v2018_06_01.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _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'}, - } - - 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) - - -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 - :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: 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - '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.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.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.v2018_06_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.v2018_06_01.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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.v2018_06_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.v2018_06_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.v2018_06_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_06_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 load balancer. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2018_06_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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. 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. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2018_06_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'}, - '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.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.v2018_06_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2018_06_01.models.SubResource - """ - - _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'}, - } - - 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) - - -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.v2018_06_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2018_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: 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 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.v2018_06_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'}, - 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetUpdateVMProfile'}, - 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, - 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, - '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.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) - self.overprovision = kwargs.get('overprovision', None) - self.single_placement_group = kwargs.get('single_placement_group', 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. - - :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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2018_06_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'}, - '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.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 network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) - 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.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - 'license_type': {'key': 'licenseType', '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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - self.license_type = kwargs.get('license_type', 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.v2018_06_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.v2018_06_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_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.v2018_06_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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - '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}, - } - - _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}'}, - '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'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.network_profile = kwargs.get('network_profile', 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) - - -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.v2018_06_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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2018_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2018_06_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2018_06_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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.v2018_06_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetStorageProfile - :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.v2018_06_01.models.AdditionalCapabilities - :param network_profile: Specifies properties of the network interfaces of the virtual machines - in the scale set. - :type network_profile: - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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". - :type priority: str or ~azure.mgmt.compute.v2018_06_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority - scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values - include: "Deallocate", "Delete". - :type eviction_policy: str or - ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineEvictionPolicyTypes - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'additional_capabilities': {'key': 'additionalCapabilities', 'type': 'AdditionalCapabilities'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - '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'}, - } - - 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.additional_capabilities = kwargs.get('additional_capabilities', None) - self.network_profile = kwargs.get('network_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) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2018_06_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_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.v2018_06_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.v2018_06_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.v2018_06_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, - 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.proximity_placement_group = kwargs.get('proximity_placement_group', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_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 virtual machine is enabled for automatic - updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :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.v2018_06_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2018_06_01.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2018_06_01.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2018_06_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2018_06_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_models_py3.py index 24d4961e4b82..7d0e026f444f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,11 +44,11 @@ def __init__( 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -59,6 +61,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -66,21 +75,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2018_06_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2018_06_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -99,6 +108,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2018_06_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -109,9 +135,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -124,6 +150,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -131,16 +162,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2018_06_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2018_06_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2018_06_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2018_06_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -161,6 +192,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2018_06_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2018_06_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -172,12 +215,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -194,6 +237,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -203,9 +254,9 @@ def __init__( class AutoOSUpgradePolicy(msrest.serialization.Model): """The configuration parameters used for performing automatic OS upgrade. - :param disable_auto_rollback: Whether OS image rollback feature should be disabled. Default + :ivar disable_auto_rollback: Whether OS image rollback feature should be disabled. Default value is false. - :type disable_auto_rollback: bool + :vartype disable_auto_rollback: bool """ _attribute_map = { @@ -218,6 +269,11 @@ def __init__( disable_auto_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword disable_auto_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :paramtype disable_auto_rollback: bool + """ super(AutoOSUpgradePolicy, self).__init__(**kwargs) self.disable_auto_rollback = disable_auto_rollback @@ -235,10 +291,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -263,6 +319,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -284,25 +346,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_06_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.v2018_06_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: + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :ivar 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.v2018_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ @@ -341,6 +403,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -355,11 +439,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -378,6 +462,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -386,8 +477,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -400,6 +491,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -409,20 +504,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2018_06_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.v2018_06_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :ivar 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.v2018_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ @@ -452,6 +547,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -464,11 +576,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -483,6 +595,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -518,6 +637,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -545,6 +666,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -590,6 +713,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -604,21 +729,21 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". - :type create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of + :vartype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOption + :ivar storage_account_id: If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str """ _validation = { @@ -643,6 +768,23 @@ def __init__( source_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOption + :keyword storage_account_id: If createOption is Import, the Azure Resource Manager identifier + of the storage account containing the blob to import as a disk. Required only if the blob is in + a different subscription. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -656,41 +798,41 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2018_06_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :ivar 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.v2018_06_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :ivar 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.v2018_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_06_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :ivar 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.v2018_06_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.ManagedDiskParameters """ _validation = { @@ -724,6 +866,43 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.ManagedDiskParameters + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -758,6 +937,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -765,11 +946,11 @@ def __init__( 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 + :ivar 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.v2018_06_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_06_01.models.BootDiagnostics """ _attribute_map = { @@ -782,6 +963,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_06_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -789,9 +977,9 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2018_06_01.models.DiffDiskOptions + :vartype option: str or ~azure.mgmt.compute.v2018_06_01.models.DiffDiskOptions """ _attribute_map = { @@ -804,6 +992,11 @@ def __init__( option: Optional[Union[str, "DiffDiskOptions"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2018_06_01.models.DiffDiskOptions + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option @@ -811,8 +1004,8 @@ def __init__( class Disallowed(msrest.serialization.Model): """Describes the disallowed disk types. - :param disk_types: A list of disk types. - :type disk_types: list[str] + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] """ _attribute_map = { @@ -825,6 +1018,10 @@ def __init__( disk_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ super(Disallowed, self).__init__(**kwargs) self.disk_types = disk_types @@ -842,43 +1039,43 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. For a description of the range of values you can set, see `Ultra SSD Managed Disk Offerings `_. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. For a description of the range of values you can set, see `Ultra SSD Managed Disk Offerings `_. - :type disk_m_bps_read_write: int + :vartype disk_m_bps_read_write: int """ _validation = { @@ -925,6 +1122,39 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. For a description of the + range of values you can set, see `Ultra SSD Managed Disk Offerings + `_. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. For a description of the range of values you can set, see `Ultra SSD Managed Disk Offerings + `_. + :paramtype disk_m_bps_read_write: int + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -942,13 +1172,13 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -965,6 +1195,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -974,13 +1213,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2018_06_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2018_06_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -997,6 +1237,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2018_06_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -1008,11 +1258,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1031,6 +1281,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1041,9 +1298,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2018_06_01.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2018_06_01.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -1063,6 +1320,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2018_06_01.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1071,27 +1333,27 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: int + :vartype disk_m_bps_read_write: int """ _attribute_map = { @@ -1116,6 +1378,29 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: int + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1129,15 +1414,15 @@ def __init__( class EncryptionSettings(msrest.serialization.Model): """Encryption settings for disk or snapshot. - :param enabled: Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndKeyReference + :vartype enabled: bool + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :vartype key_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -1154,6 +1439,18 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword enabled: Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2018_06_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettings, self).__init__(**kwargs) self.enabled = enabled self.disk_encryption_key = disk_encryption_key @@ -1173,15 +1470,15 @@ class Gallery(Resource): :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 description: The description of this Shared Image Gallery resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -1216,6 +1513,17 @@ def __init__( identifier: Optional["GalleryIdentifier"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryIdentifier + """ super(Gallery, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -1227,11 +1535,11 @@ class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource + :vartype target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource """ _validation = { @@ -1250,6 +1558,14 @@ def __init__( target_regions: Optional[List["TargetRegion"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource + """ super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) self.target_regions = target_regions self.source = source @@ -1260,8 +1576,8 @@ class GalleryArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2018_06_01.models.ManagedArtifact + :ivar managed_image: Required. The managed artifact. + :vartype managed_image: ~azure.mgmt.compute.v2018_06_01.models.ManagedArtifact """ _validation = { @@ -1278,6 +1594,10 @@ def __init__( managed_image: "ManagedArtifact", **kwargs ): + """ + :keyword managed_image: Required. The managed artifact. + :paramtype managed_image: ~azure.mgmt.compute.v2018_06_01.models.ManagedArtifact + """ super(GalleryArtifactSource, self).__init__(**kwargs) self.managed_image = managed_image @@ -1308,6 +1628,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryDiskImage, self).__init__(**kwargs) self.size_in_gb = None self.host_caching = None @@ -1345,6 +1667,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryDataDiskImage, self).__init__(**kwargs) self.lun = None @@ -1371,6 +1695,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryIdentifier, self).__init__(**kwargs) self.unique_name = None @@ -1388,40 +1714,40 @@ class GalleryImage(Resource): :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 description: The description of this gallery Image Definition resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Image Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery Image Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2018_06_01.models.OperatingSystemTypes - :param os_state: The allowed values for OS State are 'Generalized'. Possible values include: + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar os_state: The allowed values for OS State are 'Generalized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2018_06_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2018_06_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + :vartype os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery Image Definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery Image Definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2018_06_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2018_06_01.models.Disallowed + :ivar purchase_plan: Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2018_06_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2018_06_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -1474,6 +1800,42 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Image Definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Image Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword os_state: The allowed values for OS State are 'Generalized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes + :keyword end_of_life_date: The end of life date of the gallery Image Definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery Image Definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2018_06_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2018_06_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2018_06_01.models.Disallowed + :keyword purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2018_06_01.models.ImagePurchasePlan + """ super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -1494,12 +1856,12 @@ class GalleryImageIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str + :ivar publisher: Required. The name of the gallery Image Definition publisher. + :vartype publisher: str + :ivar offer: Required. The name of the gallery Image Definition offer. + :vartype offer: str + :ivar sku: Required. The name of the gallery Image Definition SKU. + :vartype sku: str """ _validation = { @@ -1522,6 +1884,14 @@ def __init__( sku: str, **kwargs ): + """ + :keyword publisher: Required. The name of the gallery Image Definition publisher. + :paramtype publisher: str + :keyword offer: Required. The name of the gallery Image Definition offer. + :paramtype offer: str + :keyword sku: Required. The name of the gallery Image Definition SKU. + :paramtype sku: str + """ super(GalleryImageIdentifier, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -1533,11 +1903,11 @@ class GalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image + :ivar value: Required. A list of Shared Image Gallery images. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] + :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1556,6 +1926,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Shared Image Gallery images. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] + :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. + :paramtype next_link: str + """ super(GalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1574,12 +1951,12 @@ class GalleryImageVersion(Resource): :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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery Image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -1622,6 +1999,15 @@ def __init__( publishing_profile: Optional["GalleryImageVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery Image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionPublishingProfile + """ super(GalleryImageVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -1634,11 +2020,11 @@ class GalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str + :ivar value: Required. A list of gallery Image Versions. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] + :ivar next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() with + this to fetch the next page of gallery Image Versions. + :vartype next_link: str """ _validation = { @@ -1657,6 +2043,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Image Versions. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] + :keyword next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() + with this to fetch the next page of gallery Image Versions. + :paramtype next_link: str + """ super(GalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1669,23 +2062,23 @@ class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase) All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime """ _validation = { @@ -1712,6 +2105,24 @@ def __init__( end_of_life_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2018_06_01.models.TargetRegion] + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2018_06_01.models.GalleryArtifactSource + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + """ super(GalleryImageVersionPublishingProfile, self).__init__(target_regions=target_regions, source=source, **kwargs) self.replica_count = replica_count self.exclude_from_latest = exclude_from_latest @@ -1744,6 +2155,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) self.os_disk_image = None self.data_disk_images = None @@ -1754,11 +2167,11 @@ class GalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + :ivar value: Required. A list of galleries. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.Gallery] + :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1777,6 +2190,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of galleries. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.Gallery] + :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :paramtype next_link: str + """ super(GalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1808,6 +2228,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryOSDiskImage, self).__init__(**kwargs) @@ -1816,10 +2238,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read". - :type access: str or ~azure.mgmt.compute.v2018_06_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read". + :vartype access: str or ~azure.mgmt.compute.v2018_06_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -1839,6 +2261,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read". + :paramtype access: str or ~azure.mgmt.compute.v2018_06_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -1847,7 +2275,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -1893,7 +2321,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2018_06_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -1906,6 +2334,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -1923,14 +2400,14 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -1963,6 +2440,16 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1974,30 +2461,31 @@ class ImageDataDisk(msrest.serialization.Model): 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 + :ivar 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype lun: int + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2018_06_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes """ _validation = { @@ -2026,6 +2514,33 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + """ super(ImageDataDisk, self).__init__(**kwargs) self.lun = lun self.snapshot = snapshot @@ -2041,12 +2556,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -2065,6 +2580,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -2075,11 +2598,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2018_06_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2098,6 +2621,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2108,33 +2638,34 @@ class ImageOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. This property allows you to specify the type of the OS that is + :ivar 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.v2018_06_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2018_06_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :ivar 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. + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes """ _validation = { @@ -2166,6 +2697,37 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemStateTypes + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", + "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + """ super(ImageOSDisk, self).__init__(**kwargs) self.os_type = os_type self.os_state = os_state @@ -2180,12 +2742,12 @@ def __init__( class ImagePurchasePlan(msrest.serialization.Model): """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str """ _attribute_map = { @@ -2202,6 +2764,14 @@ def __init__( product: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product ID. + :paramtype product: str + """ super(ImagePurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -2211,8 +2781,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2225,6 +2795,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -2232,21 +2806,21 @@ def __init__( 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. - :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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -2267,6 +2841,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -2277,19 +2868,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2018_06_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_06_01.models.ImageOSDisk + :ivar 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.v2018_06_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2018_06_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -2306,6 +2897,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_06_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2018_06_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -2317,12 +2923,12 @@ class ImageUpdate(UpdateResource): 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.v2018_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -2346,6 +2952,14 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.ImageStorageProfile + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -2355,10 +2969,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -2373,6 +2987,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -2381,16 +3001,16 @@ def __init__( 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.v2018_06_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2018_06_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -2411,6 +3031,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2018_06_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -2424,10 +3056,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -2447,6 +3079,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -2457,10 +3095,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -2480,6 +3118,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -2490,10 +3134,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2018_06_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SubResource """ _validation = { @@ -2513,6 +3157,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -2523,10 +3173,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2018_06_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SubResource """ _validation = { @@ -2546,6 +3196,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -2554,16 +3210,16 @@ def __init__( 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 + :ivar 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.v2018_06_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2018_06_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool """ _attribute_map = { @@ -2580,6 +3236,18 @@ def __init__( provision_vm_agent: Optional[bool] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2018_06_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -2591,11 +3259,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2018_06_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2614,6 +3282,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2624,19 +3299,19 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -2665,6 +3340,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -2695,6 +3385,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -2720,6 +3412,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -2727,23 +3421,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2018_06_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -2768,6 +3462,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2018_06_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -2783,8 +3496,8 @@ class ManagedArtifact(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The managed artifact id. - :type id: str + :ivar id: Required. The managed artifact id. + :vartype id: str """ _validation = { @@ -2801,6 +3514,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ super(ManagedArtifact, self).__init__(**kwargs) self.id = id @@ -2808,12 +3525,13 @@ def __init__( 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: + :ivar id: Resource Id. + :vartype id: str + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes """ _attribute_map = { @@ -2828,6 +3546,15 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type @@ -2835,11 +3562,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -2854,6 +3581,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -2861,9 +3595,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2018_06_01.models.NetworkInterfaceReference] """ @@ -2877,6 +3611,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2018_06_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -2886,48 +3626,48 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2018_06_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :ivar 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.v2018_06_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :ivar 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.v2018_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_06_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2018_06_01.models.DiffDiskSettings + :ivar 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.v2018_06_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :ivar 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.v2018_06_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.ManagedDiskParameters """ _validation = { @@ -2964,6 +3704,50 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2018_06_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -2983,9 +3767,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes """ _validation = { @@ -3002,6 +3786,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -3009,29 +3798,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -3046,31 +3834,30 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration + :ivar 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.v2018_06_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool """ _attribute_map = { @@ -3097,6 +3884,70 @@ def __init__( allow_extension_operations: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -3111,15 +3962,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -3138,6 +3989,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3158,15 +4020,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -3209,6 +4071,18 @@ def __init__( proximity_placement_group_type: Optional[Union[str, "ProximityPlacementGroupType"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupType + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -3221,10 +4095,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2018_06_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -3243,6 +4117,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3251,8 +4131,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -3265,6 +4145,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -3273,13 +4157,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -3302,6 +4186,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -3311,10 +4204,10 @@ def __init__( class RecommendedMachineConfiguration(msrest.serialization.Model): """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange """ _attribute_map = { @@ -3329,6 +4222,12 @@ def __init__( memory: Optional["ResourceRange"] = None, **kwargs ): + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2018_06_01.models.ResourceRange + """ super(RecommendedMachineConfiguration, self).__init__(**kwargs) self.v_cp_us = v_cp_us self.memory = memory @@ -3360,6 +4259,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -3399,6 +4300,8 @@ def __init__( self, **kwargs ): + """ + """ super(RegionalReplicationStatus, self).__init__(**kwargs) self.region = None self.state = None @@ -3434,6 +4337,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = None @@ -3444,22 +4349,22 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 interval_length: Required. Interval value in minutes used to create LogAnalytics call + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar 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.v2018_06_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2018_06_01.models.IntervalInMins """ _validation = { @@ -3491,6 +4396,24 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2018_06_01.models.IntervalInMins + """ 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, **kwargs) self.interval_length = interval_length @@ -3498,10 +4421,10 @@ def __init__( class ResourceRange(msrest.serialization.Model): """Describes the resource range. - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int """ _attribute_map = { @@ -3516,6 +4439,12 @@ def __init__( max: Optional[int] = None, **kwargs ): + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ super(ResourceRange, self).__init__(**kwargs) self.min = min self.max = max @@ -3551,6 +4480,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -3560,26 +4491,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -3604,6 +4535,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -3645,6 +4598,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -3687,6 +4642,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -3707,10 +4664,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -3752,6 +4709,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -3764,17 +4727,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_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 + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -3803,6 +4766,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -3816,21 +4792,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2018_06_01.models.RunCommandParameterDefinition] """ _validation = { @@ -3864,6 +4840,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2018_06_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -3874,13 +4868,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2018_06_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2018_06_01.models.RunCommandInputParameter] """ _validation = { @@ -3901,6 +4895,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2018_06_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -3912,10 +4915,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -3935,6 +4938,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -3945,11 +4954,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2018_06_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3968,6 +4977,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3978,14 +4994,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -4009,6 +5025,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -4019,8 +5045,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -4033,6 +5059,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -4040,14 +5070,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -4064,6 +5094,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -4083,28 +5123,28 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param creation_data: Disk source information. CreationData information cannot be changed after + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str """ @@ -4147,6 +5187,26 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2018_06_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -4163,11 +5223,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -4186,6 +5246,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4196,9 +5263,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2018_06_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2018_06_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -4218,6 +5285,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2018_06_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -4226,19 +5298,19 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings: Encryption settings for disk or snapshot. - :type encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + :vartype disk_size_gb: int + :ivar encryption_settings: Encryption settings for disk or snapshot. + :vartype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings """ _attribute_map = { @@ -4259,6 +5331,21 @@ def __init__( encryption_settings: Optional["EncryptionSettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings: Encryption settings for disk or snapshot. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_06_01.models.EncryptionSettings + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -4270,8 +5357,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -4284,6 +5371,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -4291,8 +5382,8 @@ def __init__( 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.v2018_06_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2018_06_01.models.SshPublicKey] """ _attribute_map = { @@ -4305,6 +5396,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2018_06_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -4312,15 +5407,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -4335,6 +5430,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -4343,21 +5449,21 @@ def __init__( 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 + :ivar 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.v2018_06_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageReference + :ivar 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.v2018_06_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_06_01.models.OSDisk + :ivar 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.v2018_06_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2018_06_01.models.DataDisk] """ _attribute_map = { @@ -4374,6 +5480,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_06_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2018_06_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -4401,6 +5524,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -4410,11 +5535,11 @@ class TargetRegion(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per + :ivar name: Required. The name of the region. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per region. This property is updatable. - :type regional_replica_count: int + :vartype regional_replica_count: int """ _validation = { @@ -4433,6 +5558,13 @@ def __init__( regional_replica_count: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. The name of the region. + :paramtype name: str + :keyword regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :paramtype regional_replica_count: int + """ super(TargetRegion, self).__init__(**kwargs) self.name = name self.regional_replica_count = regional_replica_count @@ -4443,19 +5575,19 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -4484,6 +5616,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ 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, **kwargs) @@ -4517,6 +5664,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -4565,6 +5714,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -4604,6 +5755,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -4613,22 +5766,22 @@ def __init__( 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.v2018_06_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2018_06_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradePolicy - :param automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available. - :type automatic_os_upgrade: bool - :param auto_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype automatic_os_upgrade: bool + :ivar auto_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.AutoOSUpgradePolicy + :vartype auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.AutoOSUpgradePolicy """ _attribute_map = { @@ -4647,6 +5800,24 @@ def __init__( auto_os_upgrade_policy: Optional["AutoOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2018_06_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade: Whether OS upgrades should automatically be applied to scale set + instances in a rolling fashion when a newer version of the image becomes available. + :paramtype automatic_os_upgrade: bool + :keyword auto_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype auto_os_upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.AutoOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -4663,12 +5834,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2018_06_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2018_06_01.models.UsageName """ _validation = { @@ -4695,6 +5866,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2018_06_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -4704,10 +5883,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -4722,6 +5901,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -4752,6 +5937,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -4760,21 +5947,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -4789,6 +5976,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -4797,12 +6001,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2018_06_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2018_06_01.models.VaultCertificate] """ _attribute_map = { @@ -4817,6 +6021,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2018_06_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -4825,8 +6037,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -4839,6 +6051,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -4856,37 +6072,37 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_06_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :ivar 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 @@ -4896,16 +6112,16 @@ class VirtualMachine(Resource): `_ :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.v2018_06_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: + :vartype availability_set: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar 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.v2018_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -4913,7 +6129,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -4973,6 +6189,61 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -4995,13 +6266,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5018,6 +6289,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -5029,13 +6309,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -5058,6 +6338,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -5069,8 +6358,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -5102,6 +6391,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -5122,33 +6415,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2018_06_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -5191,6 +6485,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -5206,12 +6528,12 @@ def __init__( 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.v2018_06_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus """ _attribute_map = { @@ -5228,6 +6550,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -5247,23 +6577,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -5298,6 +6628,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -5309,16 +6658,16 @@ def __init__( 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.v2018_06_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5339,6 +6688,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -5350,8 +6711,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -5364,6 +6725,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -5371,26 +6736,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -5417,6 +6782,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -5448,6 +6835,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -5463,15 +6852,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2018_06_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2018_06_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2018_06_01.models.UserAssignedIdentitiesValue] """ @@ -5494,6 +6883,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2018_06_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2018_06_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -5506,16 +6907,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -5539,6 +6940,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -5550,23 +6963,23 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2018_06_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2018_06_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2018_06_01.models.DataDiskImage] + :vartype plan: ~azure.mgmt.compute.v2018_06_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2018_06_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2018_06_01.models.DataDiskImage] """ _validation = { @@ -5596,6 +7009,25 @@ def __init__( data_disk_images: Optional[List["DataDiskImage"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2018_06_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2018_06_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2018_06_01.models.DataDiskImage] + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -5605,35 +7037,35 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2018_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2018_06_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2018_06_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_06_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5668,6 +7100,37 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2018_06_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_06_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -5688,11 +7151,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2018_06_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5711,6 +7174,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5719,9 +7189,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -5734,6 +7204,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -5751,47 +7226,46 @@ class VirtualMachineScaleSet(Resource): :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.v2018_06_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :ivar 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.v2018_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2018_06_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: 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, + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool - :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2018_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource """ _validation = { @@ -5842,6 +7316,45 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -5863,30 +7376,30 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2018_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -5917,6 +7430,33 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -5934,31 +7474,31 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: str - :param force_update_tag: If a value is provided and is different from the previous value, the + :ivar name: The name of the extension. + :vartype name: str + :ivar 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: 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -5994,6 +7534,31 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.force_update_tag = force_update_tag @@ -6012,11 +7577,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2018_06_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6035,6 +7600,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6043,8 +7615,9 @@ def __init__( 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.v2018_06_01.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -6057,6 +7630,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -6072,17 +7650,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2018_06_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: + :vartype type: str or ~azure.mgmt.compute.v2018_06_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -6105,6 +7682,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2018_06_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -6137,6 +7728,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6153,8 +7746,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] """ _validation = { @@ -6174,6 +7767,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -6202,6 +7799,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -6211,39 +7810,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2018_06_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2018_06_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2018_06_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2018_06_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :ivar 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 load balancer. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :ivar 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 load balancer. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_06_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] """ _validation = { @@ -6278,6 +7878,43 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2018_06_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2018_06_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -6293,10 +7930,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -6311,6 +7948,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -6321,11 +7964,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2018_06_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2018_06_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6344,6 +7988,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2018_06_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6354,11 +8006,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2018_06_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6377,6 +8029,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6387,11 +8046,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2018_06_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6410,6 +8069,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6420,11 +8086,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2018_06_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6443,6 +8109,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6451,11 +8124,12 @@ def __init__( 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. 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. Possible values include: + :ivar storage_account_type: 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. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes """ _attribute_map = { @@ -6468,6 +8142,14 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_06_01.models.StorageAccountTypes + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type @@ -6477,26 +8159,26 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -6527,6 +8209,28 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -6540,8 +8244,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -6554,6 +8258,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -6561,12 +8269,12 @@ def __init__( 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 + :ivar 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.v2018_06_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2018_06_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -6582,6 +8290,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2018_06_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -6592,43 +8309,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2018_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_06_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :ivar 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.v2018_06_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2018_06_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2018_06_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -6664,6 +8381,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_06_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2018_06_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_06_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -6680,25 +8437,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -6713,27 +8469,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration + :ivar 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.v2018_06_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.v2018_06_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] """ _attribute_map = { @@ -6758,6 +8514,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -6773,17 +8585,17 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2018_06_01.models.SubResource """ _validation = { @@ -6808,6 +8620,19 @@ def __init__( public_ip_prefix: Optional["SubResource"] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2018_06_01.models.SubResource + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -6821,10 +8646,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -6841,6 +8666,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -6848,9 +8679,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -6863,19 +8694,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -6890,6 +8726,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -6923,6 +8768,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -6964,6 +8811,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -6974,21 +8823,22 @@ def __init__( 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 + :ivar 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.v2018_06_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageReference + :ivar 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.v2018_06_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2018_06_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -7005,6 +8855,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -7014,31 +8882,30 @@ def __init__( 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.v2018_06_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2018_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateVMProfile - :param overprovision: Specifies whether the Virtual Machine Scale Set should be - overprovisioned. - :type overprovision: bool - :param single_placement_group: When true this limits the scale set to a single placement group, + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 proximity_placement_group: Specifies information about the proximity placement group - that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum + :vartype single_placement_group: bool + :ivar 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.v2018_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource """ _attribute_map = { @@ -7067,6 +8934,33 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2018_06_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2018_06_01.models.UpgradePolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -7081,34 +8975,34 @@ def __init__( class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): """Describes a virtual machine scale set network profile's IP configuration. - :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.v2018_06_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2018_06_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2018_06_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2018_06_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.SubResource] """ _attribute_map = { @@ -7139,6 +9033,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2018_06_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2018_06_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2018_06_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -7154,25 +9080,25 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -7199,6 +9125,27 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -7212,8 +9159,8 @@ def __init__( class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -7227,6 +9174,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -7234,23 +9186,23 @@ def __init__( 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.v2018_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2018_06_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: + :vartype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -7274,6 +9226,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2018_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_06_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -7286,14 +9258,14 @@ def __init__( 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.v2018_06_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] """ _attribute_map = { @@ -7312,6 +9284,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_06_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_06_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2018_06_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -7322,12 +9304,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -7345,6 +9327,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -7354,12 +9345,13 @@ def __init__( 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.v2018_06_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -7376,6 +9368,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2018_06_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -7385,21 +9386,22 @@ def __init__( 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.v2018_06_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str """ _attribute_map = { @@ -7422,6 +9424,24 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -7444,20 +9464,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2018_06_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2018_06_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -7470,22 +9490,22 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile + :ivar 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.v2018_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :ivar 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 @@ -7495,10 +9515,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2018_06_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2018_06_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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -7506,7 +9526,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -7565,6 +9585,54 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -7611,6 +9679,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -7619,10 +9689,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -7635,6 +9705,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -7644,8 +9720,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -7662,6 +9738,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -7671,34 +9751,34 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2018_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2018_06_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2018_06_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_06_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -7734,6 +9814,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2018_06_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2018_06_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_06_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_06_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -7753,11 +9861,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7776,6 +9884,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7784,28 +9899,28 @@ def __init__( 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.v2018_06_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetStorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar 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.v2018_06_01.models.AdditionalCapabilities - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -7813,15 +9928,15 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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. + :vartype license_type: str + :ivar 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". - :type priority: str or ~azure.mgmt.compute.v2018_06_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority + :vartype priority: str or ~azure.mgmt.compute.v2018_06_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or + :vartype eviction_policy: str or ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineEvictionPolicyTypes """ @@ -7851,6 +9966,48 @@ def __init__( eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetStorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2018_06_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for virtual machines in a low priority + scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values + include: "Deallocate", "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineEvictionPolicyTypes + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -7866,20 +10023,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -7902,6 +10059,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -7914,8 +10087,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSize] """ _attribute_map = { @@ -7928,6 +10101,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -7957,6 +10134,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -7967,33 +10146,33 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_06_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :ivar 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 @@ -8003,16 +10182,16 @@ class VirtualMachineUpdate(UpdateResource): `_ :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.v2018_06_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: + :vartype availability_set: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :ivar 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.v2018_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_06_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.v2018_06_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -8020,7 +10199,7 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -8069,6 +10248,59 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_06_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_06_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_06_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_06_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_06_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_06_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_06_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_06_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -8090,23 +10322,23 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic updates. - :type enable_automatic_updates: bool - :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2018_06_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2018_06_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2018_06_01.models.WinRMConfiguration """ _attribute_map = { @@ -8127,6 +10359,26 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + updates. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2018_06_01.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2018_06_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -8138,8 +10390,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2018_06_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2018_06_01.models.WinRMListener] """ _attribute_map = { @@ -8152,6 +10404,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2018_06_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -8159,18 +10415,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2018_06_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2018_06_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -8185,6 +10441,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2018_06_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py index b4f0af88de6e..084aba231039 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2018_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2018_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py index 31d0599fccc0..8ec07425e0a6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2018_06_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2018_06_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2018-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_06_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2018-06-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py index 5826710edf73..63bd638b4ce9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py @@ -5,25 +5,206 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleriesOperations(object): """GalleriesOperations operations. @@ -49,43 +230,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -106,16 +276,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Create or update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -127,15 +299,18 @@ def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2018_06_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +322,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,15 +348,16 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> "_models.Gallery": """Retrieves information about a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -204,27 +374,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,41 +398,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> 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 = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -285,13 +436,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -300,15 +452,17 @@ def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -322,21 +476,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,14 +495,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a resource group. :param resource_group_name: The name of the resource group. @@ -370,35 +518,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -416,16 +560,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -438,34 +583,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -483,6 +623,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py index cc5b6d8000c6..ce7037a67c1f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py @@ -5,25 +5,195 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_image_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImageVersionsOperations(object): """GalleryImageVersionsOperations operations. @@ -49,47 +219,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -110,18 +269,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Create or update a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -142,15 +303,20 @@ def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +330,21 @@ def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,18 +356,19 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": """Retrieves information about a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -234,31 +393,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -272,45 +420,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> 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 = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,15 +462,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -346,15 +486,17 @@ def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -370,23 +512,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -398,16 +531,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageVersionList"]: """List gallery Image Versions in a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -419,8 +553,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -428,37 +564,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -476,6 +610,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py index bf8a95fa88ec..fe2751497e1f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImagesOperations(object): """GalleryImagesOperations operations. @@ -49,45 +207,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image, 'GalleryImage') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -108,17 +255,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Create or update a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -134,15 +283,19 @@ def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2018_06_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,28 +308,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -188,16 +334,17 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": """Retrieves information about a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -217,28 +364,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -252,43 +389,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> 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 = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -301,14 +429,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image. :param resource_group_name: The name of the resource group. @@ -320,15 +449,17 @@ def begin_delete( :type gallery_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -343,22 +474,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -370,15 +493,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageList"]: """List gallery Image Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -396,36 +520,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -443,6 +564,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py index 6285754477f8..726352f47262 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py index 0a9db2685700..ec49c4a671a5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_06_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py index cc9b72c601bb..08bbccf8c71d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2018_06_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py index 5857dd4bdae0..701c2018eb01 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,242 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +264,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +290,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +323,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +353,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +382,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +409,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,13 +432,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -260,27 +456,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,18 +480,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2018_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -313,34 +503,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -358,24 +543,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -383,35 +571,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +613,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py index feb5b51e192b..91c85efd8815 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2018_06_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2018-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_06_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2018-06-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py index fdb06bc3c18b..ffe0c2a514f1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py index b1614fed1c19..3691c4479061 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2018_06_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extensions_operations.py index 45f03830bc44..50b1b08d7775 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2018_06_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_images_operations.py index 63ed334d7203..257030e006b7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2018_06_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_run_commands_operations.py index 64ca3bd24a65..dbfd10833ae4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_06_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py index 22e6fb68d125..594988e7e171 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +205,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +250,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +274,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +304,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,41 +330,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - vmss_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,14 +369,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -249,15 +388,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -272,22 +413,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -299,17 +432,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -330,30 +464,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,15 +490,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -383,8 +508,10 @@ def list( :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.v2018_06_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -392,36 +519,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +563,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index c652df5de931..94da44414cc6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py index 55ec1add96df..5c80b9c27b6b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,531 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +555,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +598,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +617,22 @@ def begin_reimage( :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.v2018_06_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +645,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +668,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +707,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +727,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +752,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +771,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +810,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +831,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +856,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +875,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +925,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +951,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +977,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,41 +1003,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,14 +1042,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -609,15 +1061,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -632,22 +1086,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -659,16 +1105,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -687,28 +1134,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -722,16 +1159,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -750,28 +1189,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -785,18 +1214,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -813,8 +1244,10 @@ def list( '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.v2018_06_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -822,42 +1255,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -875,6 +1305,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -882,37 +1313,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -925,14 +1347,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -945,15 +1368,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -968,22 +1393,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -995,41 +1412,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1042,14 +1451,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1060,15 +1470,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,22 +1495,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1110,41 +1514,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1157,14 +1553,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1175,15 +1572,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1198,22 +1597,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1225,41 +1616,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1272,14 +1655,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1291,15 +1675,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1314,22 +1700,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1341,41 +1719,33 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1388,14 +1758,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1406,15 +1777,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1429,22 +1802,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1456,49 +1821,39 @@ def get_long_running_output(pipeline_response): ) 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 _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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1514,17 +1869,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1537,15 +1894,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2018_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1558,28 +1919,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1591,4 +1945,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py index 44a9c5fee11b..d4cb56f21640 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,807 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +831,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +874,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +896,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +921,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +947,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +991,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1013,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1038,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,39 +1064,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,13 +1101,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -361,15 +1117,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +1141,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -409,15 +1160,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -434,27 +1186,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,48 +1210,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,14 +1257,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -539,18 +1275,22 @@ def begin_deallocate( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,24 +1302,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,45 +1325,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -642,14 +1368,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -657,18 +1384,22 @@ def begin_delete_instances( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -680,24 +1411,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -709,15 +1434,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -734,27 +1460,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -768,21 +1484,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_06_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -790,35 +1510,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,23 +1552,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2018_06_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -860,34 +1579,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,18 +1619,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -925,8 +1640,10 @@ def list_skus( :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.v2018_06_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -934,36 +1651,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -981,18 +1695,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1000,8 +1715,10 @@ def get_os_upgrade_history( :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.v2018_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1009,36 +1726,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,6 +1770,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1063,44 +1778,35 @@ def get_next(next_link=None): def _power_off_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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1113,14 +1819,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1130,18 +1837,22 @@ def begin_power_off( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1153,24 +1864,18 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1182,48 +1887,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1236,14 +1933,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1251,18 +1949,22 @@ def begin_restart( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1274,24 +1976,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1303,48 +1999,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1357,14 +2045,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1372,18 +2061,22 @@ def begin_start( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1395,24 +2088,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1424,48 +2111,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1478,14 +2157,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1494,18 +2174,22 @@ def begin_redeploy( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1517,24 +2201,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1546,48 +2224,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1600,14 +2270,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1618,18 +2289,22 @@ def begin_perform_maintenance( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1641,24 +2316,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1670,45 +2339,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1721,14 +2382,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1736,18 +2398,22 @@ def begin_update_instances( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1759,24 +2425,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1788,48 +2448,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1842,14 +2494,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1859,18 +2512,22 @@ def begin_reimage( :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.v2018_06_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1882,24 +2539,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1911,48 +2562,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1965,14 +2608,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1981,18 +2625,22 @@ def begin_reimage_all( :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2004,24 +2652,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2033,16 +2675,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2063,28 +2706,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2098,4 +2731,6 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py index f2bc4c21ba75..1acd875e5c15 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py index 39a49d93298d..0e33c0cad4a5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py @@ -5,25 +5,713 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +735,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +757,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +799,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +807,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +848,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +871,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_06_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +896,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +922,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +970,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -323,15 +992,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2018_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -343,27 +1016,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -375,47 +1042,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -433,16 +1090,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -453,15 +1112,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2018_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -473,27 +1136,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -505,39 +1162,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,13 +1199,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -565,15 +1215,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -587,21 +1239,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,23 +1258,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -641,29 +1288,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,15 +1313,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -702,27 +1340,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -736,39 +1364,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,13 +1402,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -797,15 +1419,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -819,21 +1443,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -845,39 +1462,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -890,13 +1499,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -906,15 +1516,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -928,21 +1540,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -954,15 +1559,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -979,25 +1585,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1010,20 +1608,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1031,35 +1632,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1077,22 +1674,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2018_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1100,34 +1700,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1145,18 +1740,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1165,8 +1761,10 @@ def list_available_sizes( :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.v2018_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1174,36 +1772,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1221,6 +1816,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1228,35 +1824,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1269,13 +1856,14 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1285,15 +1873,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,21 +1897,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1333,39 +1916,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1378,13 +1953,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1393,15 +1969,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1415,21 +1993,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1441,39 +2012,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1486,13 +2049,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1501,15 +2065,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1523,21 +2089,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1549,39 +2108,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1594,13 +2145,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1609,15 +2161,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1631,21 +2185,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1657,48 +2204,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1711,14 +2250,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1729,15 +2269,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1749,24 +2292,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1778,39 +2315,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1823,13 +2352,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -1838,15 +2368,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1860,21 +2392,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1886,47 +2411,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2018-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1942,16 +2457,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -1962,15 +2479,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2018_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1982,27 +2503,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2014,4 +2529,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py index ce1bd9e74923..b869582e36ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -33,52 +30,58 @@ class ComputeManagementClient(object): :vartype snapshots: azure.mgmt.compute.v2018_09_30.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py index 00c450b59f77..78cb4312784f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json index 4e66a6ba24cc..20bebc08e9ab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "disks": "DisksOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py index bbfd95310e8f..0a9753eb1e1a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py @@ -6,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -31,50 +30,58 @@ class ComputeManagementClient(object): :vartype snapshots: azure.mgmt.compute.v2018_09_30.aio.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py index 002e4033854e..fa2921f5507e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py index 2e07fb2dd4e8..ce0855669592 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2018_09_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2018_09_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py index 69412df70b6b..5fa128adae6f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2018_09_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2018_09_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/__init__.py index fdcffb85edb0..74ffa823329b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/__init__.py @@ -6,44 +6,25 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import CreationData - from ._models_py3 import Disk - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import GrantAccessData - from ._models_py3 import ImageDiskReference - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import Resource - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - from ._models import CreationData # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import ImageDiskReference # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import Resource # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore +from ._models_py3 import AccessUri +from ._models_py3 import CreationData +from ._models_py3 import Disk +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import GrantAccessData +from ._models_py3 import ImageDiskReference +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import Resource +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_compute_management_client_enums.py index c06ca084e8e9..0ed72e39ba56 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -44,7 +29,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTORE = "Restore" UPLOAD = "Upload" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the disk. """ @@ -55,7 +40,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READY_TO_UPLOAD = "ReadyToUpload" ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -64,21 +49,21 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_models.py deleted file mode 100644 index 3fe7e163a52b..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_models.py +++ /dev/null @@ -1,731 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -class CreationData(msrest.serialization.Model): - """Data used when creating a disk. - - All required parameters must be populated in order to send to Azure. - - :param create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2018_09_30.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of - the storage account containing the blob to import as a disk. Required only if the blob is in a - different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2018_09_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - """ - - _validation = { - 'create_option': {'required': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: int - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2018_09_30.models.DiskState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_state = None - - -class DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2018_09_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2018_09_30.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: int - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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 EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsElement] - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2018_09_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -class KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -class Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2018_09_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2018_09_30.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the VHD to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_models_py3.py index 768eb74a68f2..0065c95c0548 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -43,21 +45,21 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2018_09_30.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of + :vartype create_option: str or ~azure.mgmt.compute.v2018_09_30.models.DiskCreateOption + :ivar storage_account_id: If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2018_09_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2018_09_30.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str """ _validation = { @@ -82,6 +84,23 @@ def __init__( source_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_09_30.models.DiskCreateOption + :keyword storage_account_id: If createOption is Import, the Azure Resource Manager identifier + of the storage account containing the blob to import as a disk. Required only if the blob is in + a different subscription. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2018_09_30.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -103,10 +122,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -131,6 +150,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -152,45 +177,45 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :vartype sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: int + :vartype disk_m_bps_read_write: int :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2018_09_30.models.DiskState @@ -244,6 +269,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: int + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -265,11 +325,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2018_09_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2018_09_30.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -288,6 +348,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2018_09_30.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -298,9 +365,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2018_09_30.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2018_09_30.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -320,6 +387,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2018_09_30.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -328,29 +400,29 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: int + :vartype disk_m_bps_read_write: int """ _attribute_map = { @@ -375,6 +447,31 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2018_09_30.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: int + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -390,13 +487,13 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsElement] """ @@ -416,6 +513,16 @@ def __init__( encryption_settings: Optional[List["EncryptionSettingsElement"]] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsElement] + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -424,11 +531,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -443,6 +550,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2018_09_30.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -453,10 +568,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2018_09_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2018_09_30.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -476,6 +591,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2018_09_30.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -486,12 +607,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -510,6 +631,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -520,10 +649,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -543,6 +672,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -553,10 +688,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -576,6 +711,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_09_30.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -594,32 +735,32 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str @@ -665,6 +806,31 @@ def __init__( encryption_settings_collection: Optional["EncryptionSettingsCollection"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2018_09_30.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2018_09_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -682,11 +848,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2018_09_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2018_09_30.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -705,6 +871,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2018_09_30.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -715,9 +888,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2018_09_30.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2018_09_30.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -737,6 +910,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2018_09_30.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -745,20 +923,20 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection """ @@ -780,6 +958,23 @@ def __init__( encryption_settings_collection: Optional["EncryptionSettingsCollection"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2018_09_30.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_09_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the VHD to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2018_09_30.models.EncryptionSettingsCollection + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -791,8 +986,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -805,5 +1000,9 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py index e546e3ca1e85..195524efe0cb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2018_09_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2018_09_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2018-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2018-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py index 7d2b91b55e37..0c541d80104c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2018_09_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2018_09_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2018-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2018_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2018-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py index a85fe3ab63dd..583b8227f815 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py @@ -6,149 +6,137 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2018_10_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2018_10_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2018_10_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2018_10_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2018_10_01.operations.ProximityPlacementGroupsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2018_10_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2018_10_01.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2018_10_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2018_10_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2018_10_01.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2018_10_01.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py index 0597be64765b..c3b4011ce0c3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json index f2e899dafd84..4a2c35baf339 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py index eb1c9ec7f7c1..797c3f82a457 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py @@ -6,145 +6,138 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2018_10_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2018_10_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2018_10_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2018_10_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2018_10_01.aio.operations.ProximityPlacementGroupsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2018_10_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2018_10_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2018_10_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2018_10_01.aio.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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.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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py index 43f774c21d5f..4687bc87ae22 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py index 9bd3b3021cdf..8e6cfdabbed9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2018_10_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2018_10_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2018_10_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py index 311b04713ed3..ec57c9cb18a3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_10_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_10_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2018_10_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2018_10_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py index 334a429dd334..02e2a3018abf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_10_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py index 534d5e46385e..ca44e7dab931 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2018_10_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py index 45c1c07580e4..4a31c3aeca9e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -252,27 +238,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -286,8 +262,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -295,8 +274,10 @@ def list_by_subscription( """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.v2018_10_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -304,34 +285,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -349,11 +325,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -364,8 +342,10 @@ def list_by_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.v2018_10_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -373,35 +353,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +395,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py index 46436dfd27d9..97340783b967 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2018_10_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py index 21dc02b80627..2d9df4aef4d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py index 1aa79728041c..4f5f2ffddfae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2018_10_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_images_operations.py index fb9f71ad6d1b..6fd4e5968a6d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py index 14f46b2a0a20..275097a8322e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2018_10_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 8ed3e33d8ed2..a2684e4cacc0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -192,26 +190,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -224,6 +214,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -241,15 +233,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -264,22 +258,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -291,8 +277,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -321,30 +309,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -358,8 +335,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -373,8 +353,10 @@ def list( :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.v2018_10_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -382,36 +364,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +408,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 781792adda52..400542a7aad3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 658770e712a9..1238408afe97 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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.v2018_10_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -546,26 +513,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -578,6 +537,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -595,15 +556,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -618,22 +581,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -645,8 +600,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -672,28 +629,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -707,8 +654,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -734,28 +684,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -769,8 +709,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -796,8 +739,10 @@ def list( '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.v2018_10_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -805,42 +750,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -858,6 +800,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -875,26 +818,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -907,6 +842,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -926,15 +863,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -949,22 +888,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -976,6 +907,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -990,26 +922,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1022,6 +946,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1039,15 +965,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1062,22 +990,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1089,6 +1009,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1103,26 +1024,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1135,6 +1048,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1152,15 +1067,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1175,22 +1092,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1202,6 +1111,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1216,26 +1126,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1248,6 +1150,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1266,15 +1170,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1289,22 +1195,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1316,6 +1214,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1330,26 +1229,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1362,6 +1253,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1379,15 +1272,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1402,22 +1297,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1429,6 +1316,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1444,33 +1332,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1486,8 +1364,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1508,15 +1389,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1529,28 +1415,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1562,4 +1441,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py index 352036f030a6..4924628421ab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -337,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -351,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -399,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -423,27 +405,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -457,8 +429,10 @@ async def get( 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, @@ -471,33 +445,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,6 +476,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -526,18 +494,22 @@ async def begin_deallocate( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,24 +521,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -578,6 +544,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -592,30 +559,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -628,6 +587,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -642,18 +603,22 @@ async def begin_delete_instances( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -665,24 +630,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -694,8 +653,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -718,27 +679,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -752,8 +703,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -764,8 +718,10 @@ def list( :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.v2018_10_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -773,35 +729,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -819,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -833,8 +787,10 @@ def list_all( 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.v2018_10_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -842,34 +798,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -887,11 +838,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -906,8 +859,10 @@ def list_skus( :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.v2018_10_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -915,36 +870,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -962,11 +914,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -980,8 +934,10 @@ def get_os_upgrade_history( :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.v2018_10_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -989,36 +945,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1036,6 +989,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1053,33 +1007,25 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1092,6 +1038,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1108,18 +1056,22 @@ async def begin_power_off( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1131,24 +1083,18 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1160,6 +1106,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1174,33 +1121,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1213,6 +1152,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1227,18 +1168,22 @@ async def begin_restart( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1250,24 +1195,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1279,6 +1218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1293,33 +1233,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1332,6 +1264,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1346,18 +1280,22 @@ async def begin_start( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1369,24 +1307,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1398,6 +1330,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1412,33 +1345,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1451,6 +1376,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1466,18 +1393,22 @@ async def begin_redeploy( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1489,24 +1420,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1518,6 +1443,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1532,33 +1458,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1571,6 +1489,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1588,18 +1508,22 @@ async def begin_perform_maintenance( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1611,24 +1535,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1640,6 +1558,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1654,30 +1573,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1690,6 +1601,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1704,18 +1617,22 @@ async def begin_update_instances( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,24 +1644,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1756,6 +1667,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1770,33 +1682,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1809,6 +1713,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1825,18 +1731,22 @@ async def begin_reimage( :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.v2018_10_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1848,24 +1758,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1877,6 +1781,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1891,33 +1796,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1930,6 +1827,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1945,18 +1844,22 @@ async def begin_reimage_all( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1968,24 +1871,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1997,8 +1894,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2026,28 +1925,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2061,4 +1950,6 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py index 0787c2a1f4e8..06ea84609435 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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.v2018_10_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py index 384538081a19..6bd3243b8f6f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2018_10_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -314,15 +305,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +330,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -366,6 +356,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -380,32 +371,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -423,8 +404,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,15 +426,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -462,27 +451,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,6 +477,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -507,25 +491,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +514,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -552,15 +530,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,21 +554,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,8 +573,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -615,7 +590,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -627,29 +603,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -663,8 +628,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -687,27 +655,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -721,8 +679,10 @@ async def instance_view( 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, @@ -734,25 +694,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -765,6 +717,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -780,15 +734,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -802,21 +758,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -828,6 +777,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -841,25 +791,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -872,6 +814,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -887,15 +831,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -909,21 +855,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -935,8 +874,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -959,25 +900,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -990,6 +923,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1001,8 +936,10 @@ def list( :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.v2018_10_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1010,35 +947,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,11 +989,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -1069,8 +1004,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2018_10_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1078,34 +1015,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1123,11 +1055,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1142,8 +1076,10 @@ def list_available_sizes( :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.v2018_10_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1151,36 +1087,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1198,6 +1131,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1214,25 +1148,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1245,6 +1171,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1260,15 +1188,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1282,21 +1212,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1308,6 +1231,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1321,25 +1245,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1352,6 +1268,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1366,15 +1284,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1388,21 +1308,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1414,6 +1327,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1427,25 +1341,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1458,6 +1364,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1472,15 +1380,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1494,21 +1404,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1520,6 +1423,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1533,25 +1437,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1564,6 +1460,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1578,15 +1476,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1600,21 +1500,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1626,6 +1519,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1640,33 +1534,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1679,6 +1565,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1696,15 +1584,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1716,24 +1607,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1745,6 +1630,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1758,25 +1644,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1789,6 +1667,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1803,15 +1683,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1825,21 +1707,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1851,6 +1726,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1865,32 +1741,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1906,8 +1772,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1925,15 +1794,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1945,27 +1819,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1977,4 +1845,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_10_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/__init__.py index d5aa33f73a9e..e492ba988299 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/__init__.py @@ -6,310 +6,158 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -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 BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiffDiskSettings - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - 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 InstanceViewStatus - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - 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 OSProfile - 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 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 Sku - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import ThrottledRequestsInput - 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 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineReimageParameters - 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 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 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 VirtualMachineScaleSetVMProfile - from ._models_py3 import VirtualMachineScaleSetVMReimageParameters - from ._models_py3 import VirtualMachineSize - from ._models_py3 import VirtualMachineSizeListResult - 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 -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 BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # 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 DiagnosticsProfile # type: ignore - from ._models import DiffDiskSettings # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import Image # type: ignore - from ._models import ImageDataDisk # 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 InstanceViewStatus # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 OSProfile # 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 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 Sku # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import ThrottledRequestsInput # 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 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineReimageParameters # 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 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 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 VirtualMachineScaleSetVMProfile # type: ignore - from ._models import VirtualMachineScaleSetVMReimageParameters # type: ignore - from ._models import VirtualMachineSize # type: ignore - from ._models import VirtualMachineSizeListResult # 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_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 BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiffDiskSettings +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +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 InstanceViewStatus +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +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 OSProfile +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 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 Sku +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import ThrottledRequestsInput +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 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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineReimageParameters +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 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 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 VirtualMachineScaleSetVMProfile +from ._models_py3 import VirtualMachineScaleSetVMReimageParameters +from ._models_py3 import VirtualMachineSize +from ._models_py3 import VirtualMachineSizeListResult +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 ._compute_management_client_enums import ( AvailabilitySetSkuTypes, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_compute_management_client_enums.py index 866e704e5eee..bd23c32539f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -34,7 +19,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -45,13 +30,13 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiffDiskOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the ephemeral disk option for operating system disk. """ LOCAL = "Local" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -64,7 +49,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -73,7 +58,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -82,7 +67,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -91,21 +76,21 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ GENERALIZED = "Generalized" SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -113,7 +98,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -122,7 +107,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -133,14 +118,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -149,7 +134,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -157,7 +142,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -165,7 +150,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. """ @@ -175,7 +160,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -187,7 +172,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -195,7 +180,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -204,7 +189,7 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineEvictionPolicyTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -212,7 +197,7 @@ class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, DEALLOCATE = "Deallocate" DELETE = "Delete" -class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachinePriorityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the priority for the virtual machines in the scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview """ @@ -220,14 +205,14 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, REGULAR = "Regular" LOW = "Low" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_models.py deleted file mode 100644 index cfc3e09ff56a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_models.py +++ /dev/null @@ -1,6049 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2018_10_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2018_10_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2018_10_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -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. If this is set to true for Windows based scale sets, - recommendation is to set `enableAutomaticUpdates - `_ - to false. - :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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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.v2018_10_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.v2018_10_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.v2018_10_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2018_10_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2018_10_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, - **kwargs - ): - 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 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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux serial console log blob Uri. - :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.v2018_10_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 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.v2018_10_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. - - 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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.ManagedDiskParameters - """ - - _validation = { - 'lun': {'required': True}, - 'create_option': {'required': 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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 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.v2018_10_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.v2018_10_01.models.DiffDiskOptions - """ - - _attribute_map = { - 'option': {'key': 'option', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiffDiskSettings, self).__init__(**kwargs) - self.option = kwargs.get('option', None) - - -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.v2018_10_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.v2018_10_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.v2018_10_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_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 HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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.v2018_10_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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}'}, - 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Image, 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 - - -class ImageDataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_10_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.v2018_10_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - 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) - - -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.v2018_10_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(msrest.serialization.Model): - """Describes an Operating System disk. - - All required parameters must be populated in order to send to Azure. - - :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.v2018_10_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_10_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.v2018_10_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. - UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes - """ - - _validation = { - 'os_type': {'required': True}, - 'os_state': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_state': {'key': 'osState', 'type': 'str'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageOSDisk, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.os_state = kwargs['os_state'] - 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) - - -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 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. - - :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 - """ - - _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'}, - } - - 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) - - -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.v2018_10_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.v2018_10_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.v2018_10_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _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'}, - } - - 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 - - -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 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.v2018_10_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 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.v2018_10_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.v2018_10_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 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.v2018_10_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 - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, - } - - 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) - - -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.v2018_10_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 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 - """ - - _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'}, - } - - 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) - - -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.v2018_10_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.v2018_10_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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.v2018_10_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 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.v2018_10_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.v2018_10_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2018_10_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.v2018_10_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2018_10_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 - """ - - _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'}, - } - - 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) - - -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.v2018_10_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.v2018_10_01.models.SubResource] - :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.v2018_10_01.models.SubResource] - :ivar availability_sets: A list of references to all availability sets in the proximity - placement group. - :vartype availability_sets: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] - """ - - _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': '[SubResource]'}, - 'virtual_machine_scale_sets': {'key': 'properties.virtualMachineScaleSets', 'type': '[SubResource]'}, - 'availability_sets': {'key': 'properties.availabilitySets', 'type': '[SubResource]'}, - } - - 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 - - -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.v2018_10_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 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.v2018_10_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'}, - 'interval_length': {'key': 'intervalLength', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RequestRateByIntervalInput, self).__init__(**kwargs) - self.interval_length = kwargs['interval_length'] - - -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.v2018_10_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 - """ - - _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'}, - } - - 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) - - -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.v2018_10_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.v2018_10_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.v2018_10_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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 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.v2018_10_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 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.v2018_10_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.v2018_10_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.v2018_10_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 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ThrottledRequestsInput, self).__init__(**kwargs) - - -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.v2018_10_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.v2018_10_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2018_10_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type automatic_os_upgrade_policy: - ~azure.mgmt.compute.v2018_10_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: An enum describing the unit of usage measurement. Has constant 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.v2018_10_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.v2018_10_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - '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'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, - 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', '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'}, - } - - 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.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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.proximity_placement_group = kwargs.get('proximity_placement_group', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2018_10_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_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 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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2018_10_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'}, - '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.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.v2018_10_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.v2018_10_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_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.v2018_10_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2018_10_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.v2018_10_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.v2018_10_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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2018_10_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2018_10_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2018_10_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: - ~azure.mgmt.compute.v2018_10_01.models.AutomaticOSUpgradeProperties - """ - - _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}'}, - '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'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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 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.v2018_10_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2018_10_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView] - :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.v2018_10_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] - """ - - _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'}, - '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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2018_10_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 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 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.v2018_10_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.v2018_10_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2018_10_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. - :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.v2018_10_01.models.SubResource - """ - - _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]'}, - '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'}, - } - - 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.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) - - -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.v2018_10_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.v2018_10_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.v2018_10_01.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _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'}, - } - - 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) - - -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 - :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: 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - '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.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.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.v2018_10_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.v2018_10_01.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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.v2018_10_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.v2018_10_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.v2018_10_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_10_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 load balancer. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2018_10_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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. 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. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2018_10_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'}, - '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.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.v2018_10_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2018_10_01.models.SubResource - """ - - _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'}, - } - - 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) - - -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.v2018_10_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2018_10_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2018_10_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 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.v2018_10_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'}, - '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.proximity_placement_group = kwargs.get('proximity_placement_group', None) - - -class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): - """Describes a virtual machine scale set network profile's IP configuration. - - :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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2018_10_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'}, - '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.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 network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - """ - - _attribute_map = { - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) - 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.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, - 'license_type': {'key': 'licenseType', '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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - self.license_type = kwargs.get('license_type', 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.v2018_10_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.v2018_10_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_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.v2018_10_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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ - :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str - """ - - _validation = { - '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}, - } - - _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}'}, - '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'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.network_profile = kwargs.get('network_profile', 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) - - -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.v2018_10_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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2018_10_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2018_10_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2018_10_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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.v2018_10_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetStorageProfile - :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.v2018_10_01.models.AdditionalCapabilities - :param network_profile: Specifies properties of the network interfaces of the virtual machines - in the scale set. - :type network_profile: - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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". - :type priority: str or ~azure.mgmt.compute.v2018_10_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority - scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values - include: "Deallocate", "Delete". - :type eviction_policy: str or - ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineEvictionPolicyTypes - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'additional_capabilities': {'key': 'additionalCapabilities', 'type': 'AdditionalCapabilities'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - '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'}, - } - - 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.additional_capabilities = kwargs.get('additional_capabilities', None) - self.network_profile = kwargs.get('network_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) - - -class VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2018_10_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_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.v2018_10_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.v2018_10_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.v2018_10_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, - 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.availability_set = kwargs.get('availability_set', None) - self.proximity_placement_group = kwargs.get('proximity_placement_group', None) - self.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_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 virtual machine is enabled for automatic - Windows updates. 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". - :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.v2018_10_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2018_10_01.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2018_10_01.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2018_10_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2018_10_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_models_py3.py index e7fc3b7ad2c7..7dde2ae3f4cd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/models/_models_py3.py @@ -17,11 +17,11 @@ 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -34,6 +34,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -41,21 +48,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2018_10_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2018_10_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -74,6 +81,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2018_10_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -84,9 +108,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -99,6 +123,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -106,16 +135,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2018_10_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2018_10_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2018_10_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2018_10_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -136,6 +165,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2018_10_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2018_10_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -147,12 +188,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -169,6 +210,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -178,16 +227,16 @@ def __init__( 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 + :ivar 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. If this is set to true for Windows based scale sets, recommendation is to set `enableAutomaticUpdates `_ to false. - :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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -202,6 +251,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. If this is set to true for Windows based scale sets, + recommendation is to set `enableAutomaticUpdates + `_ + to false. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -212,9 +273,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -231,6 +292,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -238,15 +304,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -261,6 +327,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -279,10 +356,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -307,6 +384,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -328,25 +411,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_10_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.v2018_10_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: + :vartype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :ivar 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.v2018_10_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ @@ -385,6 +468,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -399,11 +504,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -422,6 +527,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -430,8 +542,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -444,6 +556,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -453,20 +569,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2018_10_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.v2018_10_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :ivar 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.v2018_10_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ @@ -496,6 +612,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -508,11 +641,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -527,6 +660,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -562,6 +702,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -589,6 +731,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -634,6 +778,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -648,41 +794,41 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2018_10_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :ivar 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.v2018_10_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :ivar 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.v2018_10_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_10_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :ivar 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.v2018_10_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.ManagedDiskParameters """ _validation = { @@ -716,6 +862,43 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.ManagedDiskParameters + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -750,6 +933,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -757,11 +942,11 @@ def __init__( 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 + :ivar 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.v2018_10_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_10_01.models.BootDiagnostics """ _attribute_map = { @@ -774,6 +959,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_10_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -781,9 +973,9 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2018_10_01.models.DiffDiskOptions + :vartype option: str or ~azure.mgmt.compute.v2018_10_01.models.DiffDiskOptions """ _attribute_map = { @@ -796,6 +988,11 @@ def __init__( option: Optional[Union[str, "DiffDiskOptions"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2018_10_01.models.DiffDiskOptions + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option @@ -803,13 +1000,13 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2018_10_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2018_10_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -826,6 +1023,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2018_10_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2018_10_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -835,13 +1041,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2018_10_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2018_10_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ _attribute_map = { @@ -858,6 +1065,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2018_10_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -867,7 +1084,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -913,7 +1130,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2018_10_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -926,6 +1143,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -943,14 +1209,14 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -983,6 +1249,16 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -994,30 +1270,31 @@ class ImageDataDisk(msrest.serialization.Model): 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 + :ivar 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype lun: int + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2018_10_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes """ _validation = { @@ -1046,6 +1323,33 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + """ super(ImageDataDisk, self).__init__(**kwargs) self.lun = lun self.snapshot = snapshot @@ -1061,11 +1365,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2018_10_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1084,6 +1388,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1094,33 +1405,34 @@ class ImageOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. This property allows you to specify the type of the OS that is + :ivar 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.v2018_10_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemStateTypes + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2018_10_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :ivar 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. + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes """ _validation = { @@ -1152,6 +1464,37 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemStateTypes + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", + "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + """ super(ImageOSDisk, self).__init__(**kwargs) self.os_type = os_type self.os_state = os_state @@ -1166,8 +1509,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1180,6 +1523,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1187,21 +1534,21 @@ def __init__( 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. - :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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -1222,6 +1569,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -1232,19 +1596,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2018_10_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_10_01.models.ImageOSDisk + :ivar 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.v2018_10_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2018_10_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -1261,6 +1625,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_10_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2018_10_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -1272,12 +1651,12 @@ class ImageUpdate(UpdateResource): 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.v2018_10_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -1301,6 +1680,14 @@ def __init__( storage_profile: Optional["ImageStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.ImageStorageProfile + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1310,10 +1697,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -1328,6 +1715,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -1336,16 +1729,16 @@ def __init__( 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.v2018_10_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2018_10_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -1366,6 +1759,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2018_10_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -1379,10 +1784,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2018_10_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2018_10_01.models.SubResource """ _validation = { @@ -1402,6 +1807,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2018_10_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -1412,10 +1823,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2018_10_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2018_10_01.models.SubResource """ _validation = { @@ -1435,6 +1846,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2018_10_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -1443,16 +1860,16 @@ def __init__( 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 + :ivar 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.v2018_10_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2018_10_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool """ _attribute_map = { @@ -1469,6 +1886,18 @@ def __init__( provision_vm_agent: Optional[bool] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2018_10_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -1480,11 +1909,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2018_10_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1503,6 +1932,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1513,19 +1949,19 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -1554,6 +1990,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -1584,6 +2035,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -1609,6 +2062,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -1616,23 +2071,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2018_10_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -1657,6 +2112,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2018_10_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -1670,12 +2144,13 @@ def __init__( 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: + :ivar id: Resource Id. + :vartype id: str + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes """ _attribute_map = { @@ -1690,6 +2165,15 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type @@ -1697,11 +2181,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -1716,6 +2200,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -1723,9 +2214,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2018_10_01.models.NetworkInterfaceReference] """ @@ -1739,6 +2230,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2018_10_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -1748,48 +2245,48 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2018_10_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2018_10_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2018_10_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :ivar 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.v2018_10_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :ivar 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.v2018_10_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_10_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2018_10_01.models.DiffDiskSettings + :ivar 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.v2018_10_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :ivar 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.v2018_10_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.ManagedDiskParameters """ _validation = { @@ -1826,6 +2323,50 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2018_10_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2018_10_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -1845,9 +2386,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes """ _validation = { @@ -1864,6 +2405,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -1871,29 +2417,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -1908,31 +2453,30 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration + :ivar 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.v2018_10_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool """ _attribute_map = { @@ -1959,6 +2503,70 @@ def __init__( allow_extension_operations: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -1973,15 +2581,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -2000,6 +2608,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -2020,15 +2639,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -2071,6 +2690,18 @@ def __init__( proximity_placement_group_type: Optional[Union[str, "ProximityPlacementGroupType"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupType + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -2083,10 +2714,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2018_10_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -2105,6 +2736,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2113,8 +2750,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -2127,6 +2764,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -2135,13 +2776,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -2164,6 +2805,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -2196,6 +2846,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -2206,22 +2858,22 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 interval_length: Required. Interval value in minutes used to create LogAnalytics call + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar 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.v2018_10_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2018_10_01.models.IntervalInMins """ _validation = { @@ -2253,6 +2905,24 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2018_10_01.models.IntervalInMins + """ 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, **kwargs) self.interval_length = interval_length @@ -2287,6 +2957,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -2296,26 +2968,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -2340,6 +3012,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -2381,6 +3075,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -2423,6 +3119,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -2443,10 +3141,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -2488,6 +3186,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -2500,17 +3204,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_10_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 + :vartype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -2539,6 +3243,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -2552,21 +3269,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2018_10_01.models.RunCommandParameterDefinition] """ _validation = { @@ -2600,6 +3317,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2018_10_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -2610,13 +3345,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2018_10_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2018_10_01.models.RunCommandInputParameter] """ _validation = { @@ -2637,6 +3372,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2018_10_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -2648,10 +3392,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -2671,6 +3415,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -2681,11 +3431,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2018_10_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2704,6 +3454,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2714,14 +3471,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -2745,6 +3502,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -2755,8 +3522,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ _attribute_map = { @@ -2769,6 +3536,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -2776,14 +3547,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -2800,6 +3571,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2809,8 +3590,8 @@ def __init__( 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.v2018_10_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2018_10_01.models.SshPublicKey] """ _attribute_map = { @@ -2823,6 +3604,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2018_10_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -2830,15 +3615,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -2853,6 +3638,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -2861,21 +3657,21 @@ def __init__( 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 + :ivar 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.v2018_10_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2018_10_01.models.ImageReference + :ivar 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.v2018_10_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_10_01.models.OSDisk + :ivar 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.v2018_10_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2018_10_01.models.DataDisk] """ _attribute_map = { @@ -2892,6 +3688,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2018_10_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_10_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2018_10_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -2919,6 +3732,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -2928,19 +3743,19 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -2969,6 +3784,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ 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, **kwargs) @@ -3002,6 +3832,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -3050,6 +3882,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -3089,6 +3923,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -3098,19 +3934,19 @@ def __init__( 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.v2018_10_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2018_10_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.AutomaticOSUpgradePolicy """ @@ -3128,6 +3964,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2018_10_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2018_10_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -3143,12 +3995,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2018_10_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2018_10_01.models.UsageName """ _validation = { @@ -3175,6 +4027,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2018_10_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -3184,10 +4044,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -3202,6 +4062,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -3232,6 +4098,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -3240,21 +4108,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -3269,6 +4137,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -3277,12 +4162,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2018_10_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2018_10_01.models.VaultCertificate] """ _attribute_map = { @@ -3297,6 +4182,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2018_10_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -3305,8 +4198,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -3319,6 +4212,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -3336,37 +4233,37 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_10_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :ivar 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 @@ -3376,16 +4273,16 @@ class VirtualMachine(Resource): `_ :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.v2018_10_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: + :vartype availability_set: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar 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.v2018_10_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -3393,7 +4290,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -3453,6 +4350,61 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -3475,13 +4427,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3498,6 +4450,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -3509,13 +4470,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -3538,6 +4499,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -3549,8 +4519,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -3582,6 +4552,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -3602,33 +4576,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2018_10_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -3671,6 +4646,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -3686,12 +4689,12 @@ def __init__( 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.v2018_10_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus """ _attribute_map = { @@ -3708,6 +4711,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -3727,23 +4738,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -3778,6 +4789,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -3789,16 +4819,16 @@ def __init__( 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.v2018_10_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3819,6 +4849,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -3830,8 +4872,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -3844,6 +4886,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -3851,26 +4897,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -3897,6 +4943,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -3928,6 +4996,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -3943,15 +5013,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2018_10_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2018_10_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2018_10_01.models.UserAssignedIdentitiesValue] """ @@ -3974,6 +5044,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2018_10_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2018_10_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -3986,16 +5068,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -4019,6 +5101,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -4030,25 +5124,25 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2018_10_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2018_10_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2018_10_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2018_10_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2018_10_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2018_10_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2018_10_01.models.AutomaticOSUpgradeProperties """ @@ -4081,6 +5175,29 @@ def __init__( automatic_os_upgrade_properties: Optional["AutomaticOSUpgradeProperties"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2018_10_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2018_10_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2018_10_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2018_10_01.models.AutomaticOSUpgradeProperties + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -4091,35 +5208,35 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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 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.v2018_10_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2018_10_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2018_10_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_10_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ _attribute_map = { @@ -4154,6 +5271,37 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2018_10_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_10_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -4174,11 +5322,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2018_10_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4197,6 +5345,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4205,9 +5360,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -4220,6 +5375,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -4237,53 +5397,53 @@ class VirtualMachineScaleSet(Resource): :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.v2018_10_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :ivar 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.v2018_10_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2018_10_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool - :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2018_10_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource """ _validation = { @@ -4338,6 +5498,52 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -4361,30 +5567,30 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2018_10_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -4415,6 +5621,33 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -4432,31 +5665,31 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: str - :param force_update_tag: If a value is provided and is different from the previous value, the + :ivar name: The name of the extension. + :vartype name: str + :ivar 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: 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -4492,6 +5725,31 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.force_update_tag = force_update_tag @@ -4510,11 +5768,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2018_10_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4533,6 +5791,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4541,8 +5806,9 @@ def __init__( 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.v2018_10_01.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -4555,6 +5821,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -4570,17 +5841,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2018_10_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: + :vartype type: str or ~azure.mgmt.compute.v2018_10_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -4603,6 +5873,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2018_10_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -4635,6 +5919,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -4651,8 +5937,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] """ _validation = { @@ -4672,6 +5958,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -4700,6 +5990,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -4709,39 +6001,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2018_10_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2018_10_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2018_10_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2018_10_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :ivar 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 load balancer. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :ivar 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 load balancer. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_10_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] """ _validation = { @@ -4776,6 +6069,43 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2018_10_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2018_10_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -4791,10 +6121,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -4809,6 +6139,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -4819,11 +6155,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2018_10_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2018_10_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4842,6 +6179,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2018_10_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4852,11 +6197,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2018_10_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4875,6 +6220,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4885,11 +6237,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2018_10_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4908,6 +6260,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4918,11 +6277,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2018_10_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4941,6 +6300,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4949,11 +6315,12 @@ def __init__( 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. 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. Possible values include: + :ivar storage_account_type: 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. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes """ _attribute_map = { @@ -4966,6 +6333,14 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2018_10_01.models.StorageAccountTypes + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type @@ -4975,26 +6350,26 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -5025,6 +6400,28 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -5038,8 +6435,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -5052,6 +6449,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -5059,12 +6460,12 @@ def __init__( 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 + :ivar 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.v2018_10_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2018_10_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -5080,6 +6481,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2018_10_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -5090,43 +6500,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2018_10_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2018_10_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :ivar 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.v2018_10_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2018_10_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2018_10_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -5162,6 +6572,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2018_10_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2018_10_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2018_10_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -5178,25 +6628,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -5211,27 +6660,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration + :ivar 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.v2018_10_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.v2018_10_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] """ _attribute_map = { @@ -5256,6 +6705,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -5271,17 +6776,17 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2018_10_01.models.SubResource """ _validation = { @@ -5306,6 +6811,19 @@ def __init__( public_ip_prefix: Optional["SubResource"] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2018_10_01.models.SubResource + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -5319,10 +6837,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -5339,6 +6857,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -5346,9 +6870,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -5361,19 +6885,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -5388,6 +6917,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -5421,6 +6959,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -5462,6 +7002,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -5472,21 +7014,22 @@ def __init__( 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 + :ivar 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.v2018_10_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2018_10_01.models.ImageReference + :ivar 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.v2018_10_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2018_10_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -5503,6 +7046,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2018_10_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5512,37 +7073,37 @@ def __init__( 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.v2018_10_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2018_10_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2018_10_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 proximity_placement_group: Specifies information about the proximity placement group - that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum + :vartype single_placement_group: bool + :ivar 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.v2018_10_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource """ _attribute_map = { @@ -5575,6 +7136,40 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2018_10_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2018_10_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2018_10_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -5591,34 +7186,34 @@ def __init__( class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): """Describes a virtual machine scale set network profile's IP configuration. - :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.v2018_10_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2018_10_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2018_10_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2018_10_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.SubResource] """ _attribute_map = { @@ -5649,6 +7244,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2018_10_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2018_10_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2018_10_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -5664,25 +7291,25 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -5709,6 +7336,27 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -5722,8 +7370,8 @@ def __init__( class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): """Describes a virtual machine scale set network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -5737,6 +7385,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -5744,23 +7397,23 @@ def __init__( 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.v2018_10_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2018_10_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: + :vartype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -5784,6 +7437,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2018_10_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2018_10_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -5796,14 +7469,14 @@ def __init__( 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.v2018_10_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] """ _attribute_map = { @@ -5822,6 +7495,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2018_10_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2018_10_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2018_10_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -5832,12 +7515,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -5855,6 +7538,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -5864,12 +7556,13 @@ def __init__( 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.v2018_10_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2018_10_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -5886,6 +7579,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2018_10_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5895,21 +7597,22 @@ def __init__( 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.v2018_10_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: The license type, which is for bring your own license scenario. - :type license_type: str + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str """ _attribute_map = { @@ -5932,6 +7635,24 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -5954,20 +7675,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2018_10_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2018_10_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -5980,22 +7701,22 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile + :ivar 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.v2018_10_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :ivar 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 @@ -6005,10 +7726,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2018_10_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2018_10_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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6016,7 +7737,7 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype license_type: str """ _validation = { @@ -6075,6 +7796,54 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -6121,6 +7890,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -6129,10 +7900,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -6145,6 +7916,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -6154,8 +7931,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -6172,6 +7949,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -6181,34 +7962,34 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2018_10_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2018_10_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2018_10_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2018_10_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -6244,6 +8025,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2018_10_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2018_10_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2018_10_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2018_10_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -6263,11 +8072,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6286,6 +8095,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6294,28 +8110,28 @@ def __init__( 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.v2018_10_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetStorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar 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.v2018_10_01.models.AdditionalCapabilities - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6323,15 +8139,15 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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. + :vartype license_type: str + :ivar 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". - :type priority: str or ~azure.mgmt.compute.v2018_10_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a low priority + :vartype priority: str or ~azure.mgmt.compute.v2018_10_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for virtual machines in a low priority scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or + :vartype eviction_policy: str or ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineEvictionPolicyTypes """ @@ -6361,6 +8177,48 @@ def __init__( eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetStorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2018_10_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for virtual machines in a low priority + scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values + include: "Deallocate", "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineEvictionPolicyTypes + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -6376,20 +8234,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -6412,6 +8270,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -6424,8 +8298,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSize] """ _attribute_map = { @@ -6438,6 +8312,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -6467,6 +8345,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -6477,33 +8357,33 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2018_10_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :ivar 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 @@ -6513,16 +8393,16 @@ class VirtualMachineUpdate(UpdateResource): `_ :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.v2018_10_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: + :vartype availability_set: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :ivar 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.v2018_10_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2018_10_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.v2018_10_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6530,7 +8410,7 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -6579,6 +8459,59 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2018_10_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2018_10_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2018_10_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2018_10_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2018_10_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2018_10_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2018_10_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2018_10_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -6600,24 +8533,24 @@ def __init__( 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 + :ivar 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 virtual machine is enabled for automatic + :vartype provision_vm_agent: bool + :ivar enable_automatic_updates: Indicates whether virtual machine is enabled for automatic Windows updates. 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". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2018_10_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2018_10_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2018_10_01.models.WinRMConfiguration """ _attribute_map = { @@ -6638,6 +8571,27 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword enable_automatic_updates: Indicates whether virtual machine is enabled for automatic + Windows updates. Default value is true. :code:`
    `:code:`
    ` For virtual machine scale + sets, this property can be updated and updates will take effect on OS reprovisioning. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2018_10_01.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2018_10_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -6649,8 +8603,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2018_10_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2018_10_01.models.WinRMListener] """ _attribute_map = { @@ -6663,6 +8617,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2018_10_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -6670,18 +8628,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2018_10_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2018_10_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -6696,6 +8654,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2018_10_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py index 8e00cb9e78ba..f589f28c8092 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2018_10_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_10_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2018_10_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py index 172496ef4985..9f905f190c56 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_10_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2018_10_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py index 843addff44c9..0513ad01bb8e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_10_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py index e411d15b5093..a33af69ac0ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2018_10_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py index 94f965fd6dff..82e33b91906f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,242 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +264,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +290,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +323,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +353,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +382,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +409,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,13 +432,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -260,27 +456,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,18 +480,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2018_10_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -313,34 +503,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -358,24 +543,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_10_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -383,35 +571,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +613,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py index 27c7fa81f96e..bff99457894e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py index ac4f20dc7d1f..52cc70d61ba9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2018_10_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extensions_operations.py index 9cc2cbf04cd4..d270ce42f486 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2018_10_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_images_operations.py index 12cc86e0d287..03e7c23bf74f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2018_10_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_run_commands_operations.py index 47d24f7f49f7..7d3b73dc7559 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_10_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py index a5f678f1d855..b8b9fe141f3d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +205,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +250,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +274,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +304,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,41 +330,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - vmss_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,14 +369,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -249,15 +388,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -272,22 +413,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -299,17 +432,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -330,30 +464,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,15 +490,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -383,8 +508,10 @@ def list( :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.v2018_10_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -392,36 +519,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +563,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 07422870eb4d..d9ef1526ed25 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py index 30a201900bd6..92f97303e2ad 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,531 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +555,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +598,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +617,22 @@ def begin_reimage( :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.v2018_10_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +645,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +668,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +707,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +727,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +752,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +771,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +810,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +831,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +856,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +875,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +925,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +951,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +977,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,41 +1003,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,14 +1042,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -609,15 +1061,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -632,22 +1086,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -659,16 +1105,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -687,28 +1134,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -722,16 +1159,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -750,28 +1189,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -785,18 +1214,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -813,8 +1244,10 @@ def list( '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.v2018_10_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -822,42 +1255,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -875,6 +1305,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -882,37 +1313,28 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -925,14 +1347,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -945,15 +1368,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -968,22 +1393,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -995,41 +1412,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1042,14 +1451,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1060,15 +1470,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,22 +1495,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1110,41 +1514,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1157,14 +1553,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1175,15 +1572,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1198,22 +1597,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1225,41 +1616,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1272,14 +1655,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1291,15 +1675,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1314,22 +1700,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1341,41 +1719,33 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1388,14 +1758,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1406,15 +1777,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1429,22 +1802,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1456,49 +1821,39 @@ def get_long_running_output(pipeline_response): ) 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 _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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1514,17 +1869,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1537,15 +1894,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2018_10_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1558,28 +1919,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1591,4 +1945,5 @@ def get_long_running_output(pipeline_response): ) 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/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py index 6abedea51f26..fefe664074f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,807 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +831,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +874,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +896,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +921,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +947,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +991,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1013,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1038,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,39 +1064,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,13 +1101,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -361,15 +1117,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +1141,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -409,15 +1160,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -434,27 +1186,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,48 +1210,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,14 +1257,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -539,18 +1275,22 @@ def begin_deallocate( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,24 +1302,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,45 +1325,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -642,14 +1368,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -657,18 +1384,22 @@ def begin_delete_instances( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -680,24 +1411,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -709,15 +1434,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -734,27 +1460,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -768,21 +1484,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_10_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -790,35 +1510,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,23 +1552,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2018_10_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -860,34 +1579,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,18 +1619,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -925,8 +1640,10 @@ def list_skus( :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.v2018_10_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -934,36 +1651,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -981,18 +1695,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1000,8 +1715,10 @@ def get_os_upgrade_history( :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.v2018_10_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1009,36 +1726,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,6 +1770,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1063,44 +1778,35 @@ def get_next(next_link=None): def _power_off_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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1113,14 +1819,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1130,18 +1837,22 @@ def begin_power_off( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1153,24 +1864,18 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1182,48 +1887,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1236,14 +1933,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1251,18 +1949,22 @@ def begin_restart( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1274,24 +1976,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1303,48 +1999,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1357,14 +2045,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1372,18 +2061,22 @@ def begin_start( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1395,24 +2088,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1424,48 +2111,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1478,14 +2157,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1494,18 +2174,22 @@ def begin_redeploy( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1517,24 +2201,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1546,48 +2224,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1600,14 +2270,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1618,18 +2289,22 @@ def begin_perform_maintenance( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1641,24 +2316,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1670,45 +2339,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1721,14 +2382,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1736,18 +2398,22 @@ def begin_update_instances( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1759,24 +2425,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1788,48 +2448,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1842,14 +2494,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1859,18 +2512,22 @@ def begin_reimage( :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.v2018_10_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1882,24 +2539,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1911,48 +2562,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1965,14 +2608,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1981,18 +2625,22 @@ def begin_reimage_all( :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2004,24 +2652,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2033,16 +2675,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2063,28 +2706,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2098,4 +2731,6 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py index 2864bdc98072..9527e5096d0f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_10_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py index 6810ce1be4e5..0a59ab50f19e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py @@ -5,25 +5,713 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +735,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2018_10_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +757,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +799,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +807,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +848,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +871,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2018_10_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +896,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +922,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +970,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -323,15 +992,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2018_10_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -343,27 +1016,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -375,47 +1042,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -433,16 +1090,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -453,15 +1112,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2018_10_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -473,27 +1136,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -505,39 +1162,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,13 +1199,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -565,15 +1215,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -587,21 +1239,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,23 +1258,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -641,29 +1288,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,15 +1313,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -702,27 +1340,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -736,39 +1364,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,13 +1402,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -797,15 +1419,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -819,21 +1443,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -845,39 +1462,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -890,13 +1499,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -906,15 +1516,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -928,21 +1540,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -954,15 +1559,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -979,25 +1585,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1010,20 +1608,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2018_10_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1031,35 +1632,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1077,22 +1674,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2018_10_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1100,34 +1700,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1145,18 +1740,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1165,8 +1761,10 @@ def list_available_sizes( :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.v2018_10_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1174,36 +1772,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1221,6 +1816,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1228,35 +1824,26 @@ def get_next(next_link=None): def _power_off_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1269,13 +1856,14 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1285,15 +1873,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,21 +1897,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1333,39 +1916,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1378,13 +1953,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1393,15 +1969,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1415,21 +1993,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1441,39 +2012,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1486,13 +2049,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1501,15 +2065,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1523,21 +2089,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1549,39 +2108,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1594,13 +2145,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1609,15 +2161,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1631,21 +2185,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1657,48 +2204,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1711,14 +2250,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1729,15 +2269,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1749,24 +2292,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1778,39 +2315,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2018-10-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1823,13 +2352,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -1838,15 +2368,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1860,21 +2392,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1886,47 +2411,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2018-10-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1942,16 +2457,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -1962,15 +2479,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2018_10_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2018_10_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1982,27 +2503,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2014,4 +2529,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py index 82e58a80e929..a1aee5f5f362 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py @@ -6,194 +6,168 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import DedicatedHostGroupsOperations -from .operations import DedicatedHostsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2019_03_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2019_03_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2019_03_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2019_03_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2019_03_01.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2019_03_01.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2019_03_01.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.v2019_03_01.operations.DedicatedHostsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2019_03_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2019_03_01.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2019_03_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2019_03_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2019_03_01.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2019_03_01.operations.VirtualMachineRunCommandsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2019_03_01.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2019_03_01.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2019_03_01.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2019_03_01.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationVersionsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2019_03_01.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2019_03_01.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py index d7bafac3e499..9e2d465e80c7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json index 3b59bc0b0e35..0f8b8d4ad5ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py index f286537fd09c..9950faea5530 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py @@ -6,190 +6,170 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import DedicatedHostGroupsOperations -from .operations import DedicatedHostsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import VirtualMachineRunCommandsOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2019_03_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2019_03_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2019_03_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2019_03_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2019_03_01.aio.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2019_03_01.aio.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2019_03_01.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2019_03_01.aio.operations.DedicatedHostsOperations + :vartype dedicated_hosts: + azure.mgmt.compute.v2019_03_01.aio.operations.DedicatedHostsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2019_03_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2019_03_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2019_03_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2019_03_01.aio.operations.VirtualMachineRunCommandsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2019_03_01.aio.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2019_03_01.aio.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2019_03_01.aio.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2019_03_01.aio.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2019_03_01.aio.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2019_03_01.aio.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2019_03_01.aio.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2019_03_01.aio.operations.GalleryApplicationVersionsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2019_03_01.aio.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2019_03_01.aio.operations.SnapshotsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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_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.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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_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.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py index 3a19e101e45e..21dd8afa3770 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py index 949d5c011628..28d261083835 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2019_03_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2019_03_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2019_03_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py index 7aa078359fb9..72446603651b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -254,27 +240,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -288,8 +264,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -301,8 +280,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -310,35 +291,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -356,11 +333,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -369,8 +348,10 @@ def list_by_subscription( 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.v2019_03_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -378,34 +359,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -423,6 +399,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py index 2fc1f615df83..781b0af27c8d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -438,7 +417,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -450,30 +430,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -487,8 +456,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -503,8 +475,10 @@ def list_by_host_group( :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.v2019_03_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -512,36 +486,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -559,6 +530,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py index 572b4b2cca9a..c77eedca0c79 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2019_03_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2019_03_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_03_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py index 599c14d5f84e..c9f4022d8608 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._galleries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,19 @@ async def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2019_03_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,8 +169,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -197,27 +195,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +219,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -244,27 +234,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -277,6 +257,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -291,15 +273,17 @@ async def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,21 +297,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,8 +316,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -352,7 +331,8 @@ def list_by_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 GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -360,35 +340,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -406,11 +382,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -419,7 +397,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -427,34 +406,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -472,6 +446,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py index 501e6c77ef4c..ef0f71f1e48c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_application_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_application_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -133,18 +131,24 @@ async def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +162,21 @@ async def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,8 +188,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -228,31 +226,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -281,29 +270,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -316,6 +295,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -339,15 +320,17 @@ async def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -363,23 +346,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -391,8 +365,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, resource_group_name: str, @@ -411,8 +387,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -420,37 +398,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -468,6 +444,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py index f2cdbe28111f..85dcd58146ee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -129,15 +127,20 @@ async def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2019_03_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +153,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,8 +179,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -212,28 +210,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,8 +235,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -261,28 +251,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,6 +275,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -313,15 +295,17 @@ async def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +320,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -363,8 +339,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -379,8 +357,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -388,36 +368,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +412,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py index 36d85cfd2e5d..1a9f7819484a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_image_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_image_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -136,15 +134,20 @@ async def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +161,21 @@ async def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,8 +187,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -227,31 +224,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -265,8 +251,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -280,29 +268,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -315,6 +293,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -337,15 +317,17 @@ async def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -361,23 +343,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -389,8 +362,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, resource_group_name: str, @@ -409,8 +384,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -418,37 +395,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -466,6 +441,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py index c35707630021..468f9a2dccea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -128,15 +126,19 @@ async def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2019_03_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +151,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -182,8 +177,10 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -210,28 +207,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -245,8 +232,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -259,28 +248,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,6 +272,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -311,15 +292,17 @@ async def begin_delete( :type gallery_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -334,22 +317,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -361,8 +336,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -378,7 +355,8 @@ def list_by_gallery( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] @@ -386,36 +364,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -433,6 +408,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py index 0ee11e180e4c..fe9dd81405d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_03_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_03_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2019_03_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2019_03_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py index b8ddf8c8700f..66348c57ddd4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py index 2c72afef258a..bca3cce67d9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2019_03_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py index 17da591ce07f..59ac44cc65ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -252,27 +238,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -286,8 +262,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -295,8 +274,10 @@ def list_by_subscription( """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.v2019_03_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -304,34 +285,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -349,11 +325,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -364,8 +342,10 @@ def list_by_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.v2019_03_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -373,35 +353,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +395,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py index 99d94d66ca46..b849d438d4a6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_03_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py index 97c2a51023f3..1dae671ea922 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2019_03_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py index 6f77b960574d..1fc1dfa0ba02 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py index 0411d309e156..9c30a831ad76 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2019_03_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_images_operations.py index b98b37101c22..97507f0f297e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py index 4faf4d8f7470..59bbf6016a0d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2019_03_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 87a6014579c3..539973e2ab74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( @@ -192,26 +190,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -224,6 +214,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -241,15 +233,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -264,22 +258,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -291,8 +277,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -321,30 +309,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -358,8 +335,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -373,8 +353,10 @@ def list( :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.v2019_03_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -382,36 +364,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +408,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 44d76ebca8f6..bd209d49f850 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index a0b960f4289a..4dc26997ad0f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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.v2019_03_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -546,26 +513,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -578,6 +537,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -595,15 +556,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -618,22 +581,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -645,8 +600,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -663,7 +620,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -675,30 +633,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -712,8 +659,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -739,28 +689,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -774,8 +714,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -801,8 +744,10 @@ def list( '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.v2019_03_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -810,42 +755,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -863,6 +805,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -881,28 +824,19 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -915,6 +849,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -939,15 +875,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -963,22 +901,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -990,6 +920,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1004,26 +935,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1036,6 +959,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1053,15 +978,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1076,22 +1003,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1103,6 +1022,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1117,26 +1037,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1149,6 +1061,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1166,15 +1080,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1189,22 +1105,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1216,6 +1124,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1230,26 +1139,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1262,6 +1163,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1280,15 +1183,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1303,22 +1208,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1330,6 +1227,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1344,26 +1242,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1376,6 +1266,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1393,15 +1285,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1416,22 +1310,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1443,6 +1329,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1458,33 +1345,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1500,8 +1377,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1522,15 +1402,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1543,28 +1428,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1576,4 +1454,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py index 1edc8c73fd36..f9896b36220e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -337,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -351,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -399,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -423,27 +405,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -457,8 +429,10 @@ async def get( 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, @@ -471,33 +445,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,6 +476,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -526,18 +494,22 @@ async def begin_deallocate( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,24 +521,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -578,6 +544,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -592,30 +559,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -628,6 +587,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -642,18 +603,22 @@ async def begin_delete_instances( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -665,24 +630,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -694,8 +653,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -718,27 +679,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -752,8 +703,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -764,8 +718,10 @@ def list( :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.v2019_03_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -773,35 +729,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -819,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -833,8 +787,10 @@ def list_all( 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.v2019_03_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -842,34 +798,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -887,11 +838,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -906,8 +859,10 @@ def list_skus( :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.v2019_03_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -915,36 +870,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -962,11 +914,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -980,8 +934,10 @@ def get_os_upgrade_history( :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.v2019_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -989,36 +945,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1036,6 +989,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1054,35 +1008,26 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1095,6 +1040,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1116,18 +1063,22 @@ async def begin_power_off( 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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1140,24 +1091,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1169,6 +1114,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1183,33 +1129,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1222,6 +1160,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1236,18 +1176,22 @@ async def begin_restart( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1259,24 +1203,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1288,6 +1226,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1302,33 +1241,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1341,6 +1272,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1355,18 +1288,22 @@ async def begin_start( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1378,24 +1315,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1407,6 +1338,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1421,33 +1353,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1460,6 +1384,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1475,18 +1401,22 @@ async def begin_redeploy( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1498,24 +1428,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1527,6 +1451,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1541,33 +1466,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1580,6 +1497,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1597,18 +1516,22 @@ async def begin_perform_maintenance( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1620,24 +1543,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1649,6 +1566,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1663,30 +1581,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1699,6 +1609,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1713,18 +1625,22 @@ async def begin_update_instances( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,24 +1652,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1765,6 +1675,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1779,33 +1690,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1818,6 +1721,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1834,18 +1739,22 @@ async def begin_reimage( :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.v2019_03_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1857,24 +1766,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1886,6 +1789,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1900,33 +1804,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1939,6 +1835,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1954,18 +1852,22 @@ async def begin_reimage_all( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1977,24 +1879,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2006,8 +1902,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2035,28 +1933,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2070,8 +1958,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2086,7 +1977,8 @@ async def convert_to_single_placement_group( :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.v2019_03_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2019_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 @@ -2097,30 +1989,22 @@ async def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2132,3 +2016,4 @@ async def convert_to_single_placement_group( return cls(pipeline_response, None, {}) convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py index 43c33543bf20..2dbb7c309f7d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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.v2019_03_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py index ae4b44ba14b4..4b8e141f4780 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2019_03_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -314,15 +305,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +330,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -366,6 +356,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -380,32 +371,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -423,8 +404,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,15 +426,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -462,27 +451,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,6 +477,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -507,25 +491,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +514,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -552,15 +530,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,21 +554,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,8 +573,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -615,7 +590,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -627,29 +603,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -663,8 +628,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -687,27 +655,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -721,8 +679,10 @@ async def instance_view( 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, @@ -734,25 +694,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -765,6 +717,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -780,15 +734,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -802,21 +758,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -828,6 +777,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -841,25 +791,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -872,6 +814,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -887,15 +831,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -909,21 +855,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -935,8 +874,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -959,25 +900,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -990,6 +923,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1001,8 +936,10 @@ def list( :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.v2019_03_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1010,35 +947,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,11 +989,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -1069,8 +1004,10 @@ def list_all( the response to get the next page of virtual machines. :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.v2019_03_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1078,34 +1015,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1123,11 +1055,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1142,8 +1076,10 @@ def list_available_sizes( :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.v2019_03_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1151,36 +1087,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1198,6 +1131,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1215,27 +1149,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1248,6 +1173,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1268,15 +1195,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1291,21 +1220,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1317,6 +1239,7 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( @@ -1330,25 +1253,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1361,6 +1276,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1375,15 +1292,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1397,21 +1316,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1423,6 +1335,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1436,25 +1349,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1467,6 +1372,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1481,15 +1388,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1503,21 +1412,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1529,6 +1431,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1542,25 +1445,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1573,6 +1468,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1587,15 +1484,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1609,21 +1508,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1635,6 +1527,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1649,33 +1542,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1688,6 +1573,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1705,15 +1592,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1725,24 +1615,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1754,6 +1638,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1767,25 +1652,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1798,6 +1675,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1812,15 +1691,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1834,21 +1715,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1860,6 +1734,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1874,32 +1749,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1915,8 +1780,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1934,15 +1802,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1954,27 +1827,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1986,4 +1853,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_03_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py index 998f7ba41e89..2ad1f9f69db5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py @@ -6,436 +6,221 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - 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 BillingProfile - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import CreationData - 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 DedicatedHostGroupListResult - from ._models_py3 import DedicatedHostGroupUpdate - from ._models_py3 import DedicatedHostInstanceView - from ._models_py3 import DedicatedHostListResult - from ._models_py3 import DedicatedHostUpdate - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiffDiskSettings - from ._models_py3 import Disallowed - from ._models_py3 import Disk - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import Gallery - from ._models_py3 import GalleryApplication - from ._models_py3 import GalleryApplicationList - from ._models_py3 import GalleryApplicationVersion - from ._models_py3 import GalleryApplicationVersionList - from ._models_py3 import GalleryApplicationVersionPublishingProfile - from ._models_py3 import GalleryArtifactPublishingProfileBase - from ._models_py3 import GalleryArtifactSource - from ._models_py3 import GalleryDataDiskImage - from ._models_py3 import GalleryDiskImage - from ._models_py3 import GalleryIdentifier - from ._models_py3 import GalleryImage - from ._models_py3 import GalleryImageIdentifier - from ._models_py3 import GalleryImageList - from ._models_py3 import GalleryImageVersion - from ._models_py3 import GalleryImageVersionList - from ._models_py3 import GalleryImageVersionPublishingProfile - from ._models_py3 import GalleryImageVersionStorageProfile - from ._models_py3 import GalleryList - from ._models_py3 import GalleryOSDiskImage - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDiskReference - from ._models_py3 import ImageListResult - from ._models_py3 import ImageOSDisk - from ._models_py3 import ImagePurchasePlan - from ._models_py3 import ImageReference - from ._models_py3 import ImageStorageProfile - from ._models_py3 import ImageUpdate - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - from ._models_py3 import LogAnalyticsInputBase - from ._models_py3 import LogAnalyticsOperationResult - from ._models_py3 import LogAnalyticsOutput - from ._models_py3 import MaintenanceRedeployStatus - from ._models_py3 import ManagedArtifact - 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 OSProfile - 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 RecommendedMachineConfiguration - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RegionalReplicationStatus - from ._models_py3 import ReplicationStatus - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - from ._models_py3 import ResourceRange - 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 Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import TargetRegion - from ._models_py3 import TerminateNotificationProfile - from ._models_py3 import ThrottledRequestsInput - 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 UserArtifactManage - from ._models_py3 import UserArtifactSource - 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineReimageParameters - 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 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 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 VirtualMachineStatusCodeCount - from ._models_py3 import VirtualMachineUpdate - from ._models_py3 import WinRMConfiguration - from ._models_py3 import WinRMListener - from ._models_py3 import WindowsConfiguration -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - 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 BillingProfile # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeOperationListResult # type: ignore - from ._models import ComputeOperationValue # type: ignore - from ._models import CreationData # 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 DedicatedHostGroupListResult # type: ignore - from ._models import DedicatedHostGroupUpdate # type: ignore - from ._models import DedicatedHostInstanceView # 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 Disallowed # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import Gallery # type: ignore - from ._models import GalleryApplication # type: ignore - from ._models import GalleryApplicationList # type: ignore - from ._models import GalleryApplicationVersion # type: ignore - from ._models import GalleryApplicationVersionList # type: ignore - from ._models import GalleryApplicationVersionPublishingProfile # type: ignore - from ._models import GalleryArtifactPublishingProfileBase # type: ignore - from ._models import GalleryArtifactSource # type: ignore - from ._models import GalleryDataDiskImage # type: ignore - from ._models import GalleryDiskImage # type: ignore - from ._models import GalleryIdentifier # type: ignore - from ._models import GalleryImage # type: ignore - from ._models import GalleryImageIdentifier # type: ignore - from ._models import GalleryImageList # type: ignore - from ._models import GalleryImageVersion # type: ignore - from ._models import GalleryImageVersionList # type: ignore - from ._models import GalleryImageVersionPublishingProfile # type: ignore - from ._models import GalleryImageVersionStorageProfile # type: ignore - from ._models import GalleryList # type: ignore - from ._models import GalleryOSDiskImage # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import Image # type: ignore - from ._models import ImageDataDisk # type: ignore - from ._models import ImageDiskReference # type: ignore - from ._models import ImageListResult # type: ignore - from ._models import ImageOSDisk # type: ignore - from ._models import ImagePurchasePlan # 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 InstanceViewStatus # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 ManagedArtifact # 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 OSProfile # 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 RecommendedMachineConfiguration # type: ignore - from ._models import RecoveryWalkResponse # type: ignore - from ._models import RegionalReplicationStatus # type: ignore - from ._models import ReplicationStatus # type: ignore - from ._models import RequestRateByIntervalInput # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRange # 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 Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import TargetRegion # type: ignore - from ._models import TerminateNotificationProfile # type: ignore - from ._models import ThrottledRequestsInput # 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 UserArtifactManage # type: ignore - from ._models import UserArtifactSource # 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineReimageParameters # 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 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 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 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_py3 import AccessUri +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 BillingProfile +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import CreationData +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 DedicatedHostGroupListResult +from ._models_py3 import DedicatedHostGroupUpdate +from ._models_py3 import DedicatedHostInstanceView +from ._models_py3 import DedicatedHostListResult +from ._models_py3 import DedicatedHostUpdate +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiffDiskSettings +from ._models_py3 import Disallowed +from ._models_py3 import Disk +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import Gallery +from ._models_py3 import GalleryApplication +from ._models_py3 import GalleryApplicationList +from ._models_py3 import GalleryApplicationVersion +from ._models_py3 import GalleryApplicationVersionList +from ._models_py3 import GalleryApplicationVersionPublishingProfile +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryIdentifier +from ._models_py3 import GalleryImage +from ._models_py3 import GalleryImageIdentifier +from ._models_py3 import GalleryImageList +from ._models_py3 import GalleryImageVersion +from ._models_py3 import GalleryImageVersionList +from ._models_py3 import GalleryImageVersionPublishingProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryList +from ._models_py3 import GalleryOSDiskImage +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDiskReference +from ._models_py3 import ImageListResult +from ._models_py3 import ImageOSDisk +from ._models_py3 import ImagePurchasePlan +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import ImageUpdate +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +from ._models_py3 import LogAnalyticsInputBase +from ._models_py3 import LogAnalyticsOperationResult +from ._models_py3 import LogAnalyticsOutput +from ._models_py3 import MaintenanceRedeployStatus +from ._models_py3 import ManagedArtifact +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 OSProfile +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 RecommendedMachineConfiguration +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RegionalReplicationStatus +from ._models_py3 import ReplicationStatus +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceRange +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 Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import TargetRegion +from ._models_py3 import TerminateNotificationProfile +from ._models_py3 import ThrottledRequestsInput +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 UserArtifactManage +from ._models_py3 import UserArtifactSource +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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineReimageParameters +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 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 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 VirtualMachineStatusCodeCount +from ._models_py3 import VirtualMachineUpdate +from ._models_py3 import WinRMConfiguration +from ._models_py3 import WinRMListener +from ._models_py3 import WindowsConfiguration + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py index f42046f8bca6..a161f3e044a6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the aggregated replication status based on all the regional replication status flags. """ @@ -41,7 +26,7 @@ class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, E COMPLETED = "Completed" FAILED = "Failed" -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -49,7 +34,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -60,7 +45,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -71,13 +56,13 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiffDiskOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the ephemeral disk option for operating system disk. """ LOCAL = "Local" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -99,7 +84,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the disk. UPLOAD = "Upload" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -112,7 +97,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the disk. """ @@ -129,7 +114,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -144,7 +129,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: databases (for example, SQL, Oracle), and other transaction-heavy workloads. ULTRA_SSD_LRS = "UltraSSD_LRS" -class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -155,7 +140,7 @@ class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseI DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImagePropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -166,7 +151,7 @@ class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImageVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -177,7 +162,7 @@ class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensi DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -188,7 +173,7 @@ class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta DELETING = "Deleting" MIGRATING = "Migrating" -class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' """ @@ -196,28 +181,28 @@ class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -226,7 +211,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -235,7 +220,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -244,7 +229,7 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -253,14 +238,14 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -268,7 +253,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -277,7 +262,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the regional replication state. """ @@ -286,11 +271,11 @@ class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAILED = "Failed" -class ReplicationStatusTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationStatusTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REPLICATION_STATUS = "ReplicationStatus" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -301,14 +286,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -317,7 +302,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -325,7 +310,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -336,7 +321,7 @@ class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Standard zone redundant storage. STANDARD_ZRS = "Standard_ZRS" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -344,7 +329,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type to be used to store the image. This property is not updatable. """ @@ -352,7 +337,7 @@ class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_LRS = "Standard_LRS" STANDARD_ZRS = "Standard_ZRS" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. @@ -367,7 +352,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -379,7 +364,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -387,7 +372,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -396,14 +381,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -413,20 +398,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py deleted file mode 100644 index 3da31d2b9268..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py +++ /dev/null @@ -1,8667 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2019_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_03_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_03_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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.v2019_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.v2019_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.v2019_03_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2019_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_03_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2019_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, - **kwargs - ): - 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 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, - **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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux serial console log blob Uri. - :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.v2019_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 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.v2019_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 CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of - the storage account containing the blob to import as a disk. Required only if the blob is in a - different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', None) - - -class DataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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 - """ - - _validation = { - 'lun': {'required': True}, - 'create_option': {'required': 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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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.v2019_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.v2019_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.v2019_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.v2019_03_01.models.DedicatedHostInstanceView - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'platform_fault_domain': {'maximum': 2, '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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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.v2019_03_01.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, - } - - def __init__( - self, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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.v2019_03_01.models.SubResourceReadOnly] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'platform_fault_domain_count': {'maximum': 3, 'minimum': 1}, - 'hosts': {'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]'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2019_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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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.v2019_03_01.models.SubResourceReadOnly] - """ - - _validation = { - 'platform_fault_domain_count': {'maximum': 3, 'minimum': 1}, - 'hosts': {'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]'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2019_03_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', 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.v2019_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.v2019_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.v2019_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.v2019_03_01.models.DedicatedHostInstanceView - """ - - _validation = { - 'platform_fault_domain': {'maximum': 2, '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.v2019_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.v2019_03_01.models.DiffDiskOptions - """ - - _attribute_map = { - 'option': {'key': 'option', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiffDiskSettings, self).__init__(**kwargs) - self.option = kwargs.get('option', None) - - -class Disallowed(msrest.serialization.Model): - """Describes the disallowed disk types. - - :param disk_types: A list of disk types. - :type disk_types: list[str] - """ - - _attribute_map = { - 'disk_types': {'key': 'diskTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Disallowed, self).__init__(**kwargs) - self.disk_types = kwargs.get('disk_types', None) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: int - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2019_03_01.models.DiskState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_state = None - - -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.v2019_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.v2019_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.v2019_03_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_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 DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: int - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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 EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class Gallery(Resource): - """Specifies information about the Shared Image Gallery that you want to create or update. - - 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 description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_03_01.models.GalleryPropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Gallery, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - - -class GalleryApplication(Resource): - """Specifies information about the gallery Application Definition that you want to create or update. - - 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 description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplication, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationList(msrest.serialization.Model): - """The List Gallery Applications operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application - Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryApplicationVersion(Resource): - """Specifies information about the gallery Application Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_03_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryApplicationVersionList(msrest.serialization.Model): - """The List Gallery Application version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call - ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplicationVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): - """Describes the basic gallery artifact publishing profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) - self.target_regions = kwargs.get('target_regions', None) - self.replica_count = kwargs.get('replica_count', None) - self.exclude_from_latest = kwargs.get('exclude_from_latest', None) - self.published_date = None - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - - -class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image version. - - 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 target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool - """ - - _validation = { - 'published_date': {'readonly': True}, - 'source': {'required': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, - 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) - self.source = kwargs['source'] - self.manage_actions = kwargs.get('manage_actions', None) - self.enable_health_check = kwargs.get('enable_health_check', None) - - -class GalleryArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2019_03_01.models.ManagedArtifact - """ - - _validation = { - 'managed_image': {'required': True}, - } - - _attribute_map = { - 'managed_image': {'key': 'managedImage', 'type': 'ManagedArtifact'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactSource, self).__init__(**kwargs) - self.managed_image = kwargs['managed_image'] - - -class GalleryDiskImage(msrest.serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.v2019_03_01.models.HostCaching - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'host_caching': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDiskImage, self).__init__(**kwargs) - self.size_in_gb = None - self.host_caching = None - - -class GalleryDataDiskImage(GalleryDiskImage): - """This is the data disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.v2019_03_01.models.HostCaching - :ivar lun: This property specifies the logical unit number of the data disk. This value is used - to identify data disks within the Virtual Machine and therefore must be unique for each data - disk attached to the Virtual Machine. - :vartype lun: int - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'host_caching': {'readonly': True}, - 'lun': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDataDiskImage, self).__init__(**kwargs) - self.lun = None - - -class GalleryIdentifier(msrest.serialization.Model): - """Describes the gallery unique name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated - automatically by Azure. - :vartype unique_name: str - """ - - _validation = { - 'unique_name': {'readonly': True}, - } - - _attribute_map = { - 'unique_name': {'key': 'uniqueName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryIdentifier, self).__init__(**kwargs) - self.unique_name = None - - -class GalleryImage(Resource): - """Specifies information about the gallery Image Definition that you want to create or update. - - 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 description: The description of this gallery Image Definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2019_03_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_03_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_03_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_03_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_03_01.models.GalleryImagePropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImage, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageIdentifier(msrest.serialization.Model): - """This is the gallery Image Definition identifier. - - All required parameters must be populated in order to send to Azure. - - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str - """ - - _validation = { - 'publisher': {'required': True}, - 'offer': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageIdentifier, self).__init__(**kwargs) - self.publisher = kwargs['publisher'] - self.offer = kwargs['offer'] - self.sku = kwargs['sku'] - - -class GalleryImageList(msrest.serialization.Model): - """The List Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersion(Resource): - """Specifies information about the gallery Image Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionPropertiesProvisioningState - :ivar storage_profile: This is the storage profile of a Gallery Image Version. - :vartype storage_profile: - ~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_03_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'storage_profile': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = None - self.replication_status = None - - -class GalleryImageVersionList(msrest.serialization.Model): - """The List Gallery Image version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. - - 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 target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_03_01.models.GalleryArtifactSource - """ - - _validation = { - 'published_date': {'readonly': True}, - 'source': {'required': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionPublishingProfile, self).__init__(**kwargs) - self.source = kwargs['source'] - - -class GalleryImageVersionStorageProfile(msrest.serialization.Model): - """This is the storage profile of a Gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar os_disk_image: This is the OS disk image. - :vartype os_disk_image: ~azure.mgmt.compute.v2019_03_01.models.GalleryOSDiskImage - :ivar data_disk_images: A list of data disk images. - :vartype data_disk_images: list[~azure.mgmt.compute.v2019_03_01.models.GalleryDataDiskImage] - """ - - _validation = { - 'os_disk_image': {'readonly': True}, - 'data_disk_images': {'readonly': True}, - } - - _attribute_map = { - 'os_disk_image': {'key': 'osDiskImage', 'type': 'GalleryOSDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[GalleryDataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) - self.os_disk_image = None - self.data_disk_images = None - - -class GalleryList(msrest.serialization.Model): - """The List Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Gallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :vartype host_caching: str or ~azure.mgmt.compute.v2019_03_01.models.HostCaching - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'host_caching': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryOSDiskImage, self).__init__(**kwargs) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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.v2019_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_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}'}, - '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.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 ImageDataDisk(msrest.serialization.Model): - """Describes a data disk. - - 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_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.v2019_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - 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) - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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.v2019_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(msrest.serialization.Model): - """Describes an Operating System disk. - - All required parameters must be populated in order to send to Azure. - - :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.v2019_03_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_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.v2019_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. - UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes - """ - - _validation = { - 'os_type': {'required': True}, - 'os_state': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_state': {'key': 'osState', 'type': 'str'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageOSDisk, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.os_state = kwargs['os_state'] - 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) - - -class ImagePurchasePlan(msrest.serialization.Model): - """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImagePurchasePlan, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.publisher = kwargs.get('publisher', None) - self.product = kwargs.get('product', 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 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. - - :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 - """ - - _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'}, - } - - 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) - - -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.v2019_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.v2019_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.v2019_03_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_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 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.v2019_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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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.v2019_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.v2019_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 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.v2019_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 - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, - } - - 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) - - -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.v2019_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 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 - """ - - _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'}, - } - - 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) - - -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.v2019_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.v2019_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 ManagedArtifact(msrest.serialization.Model): - """The managed artifact. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The managed artifact id. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedArtifact, self).__init__(**kwargs) - self.id = kwargs['id'] - - -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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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.v2019_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 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.v2019_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.v2019_03_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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 OSProfile(msrest.serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :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:`
    ` **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.v2019_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.v2019_03_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2019_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 - from the virtual machine. - :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 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.v2019_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.v2019_03_01.models.SubResource] - :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.v2019_03_01.models.SubResource] - :ivar availability_sets: A list of references to all availability sets in the proximity - placement group. - :vartype availability_sets: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] - """ - - _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': '[SubResource]'}, - 'virtual_machine_scale_sets': {'key': 'properties.virtualMachineScaleSets', 'type': '[SubResource]'}, - 'availability_sets': {'key': 'properties.availabilitySets', 'type': '[SubResource]'}, - } - - 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 - - -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.v2019_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 RecommendedMachineConfiguration(msrest.serialization.Model): - """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange - """ - - _attribute_map = { - 'v_cp_us': {'key': 'vCPUs', 'type': 'ResourceRange'}, - 'memory': {'key': 'memory', 'type': 'ResourceRange'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedMachineConfiguration, self).__init__(**kwargs) - self.v_cp_us = kwargs.get('v_cp_us', None) - self.memory = kwargs.get('memory', None) - - -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 RegionalReplicationStatus(msrest.serialization.Model): - """This is the regional replication status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: The region to which the gallery Image Version is being replicated to. - :vartype region: str - :ivar state: This is the regional replication state. Possible values include: "Unknown", - "Replicating", "Completed", "Failed". - :vartype state: str or ~azure.mgmt.compute.v2019_03_01.models.ReplicationState - :ivar details: The details of the replication status. - :vartype details: str - :ivar progress: It indicates progress of the replication job. - :vartype progress: int - """ - - _validation = { - 'region': {'readonly': True}, - 'state': {'readonly': True}, - 'details': {'readonly': True}, - 'progress': {'readonly': True}, - } - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalReplicationStatus, self).__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None - - -class ReplicationStatus(msrest.serialization.Model): - """This is the replication status of the gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: This is the aggregated replication status based on all the regional - replication status flags. Possible values include: "Unknown", "InProgress", "Completed", - "Failed". - :vartype aggregated_state: str or - ~azure.mgmt.compute.v2019_03_01.models.AggregatedReplicationState - :ivar summary: This is a summary of replication status for each region. - :vartype summary: list[~azure.mgmt.compute.v2019_03_01.models.RegionalReplicationStatus] - """ - - _validation = { - 'aggregated_state': {'readonly': True}, - 'summary': {'readonly': True}, - } - - _attribute_map = { - 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': '[RegionalReplicationStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationStatus, self).__init__(**kwargs) - self.aggregated_state = None - self.summary = 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 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.v2019_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'}, - 'interval_length': {'key': 'intervalLength', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RequestRateByIntervalInput, self).__init__(**kwargs) - self.interval_length = kwargs['interval_length'] - - -class ResourceRange(msrest.serialization.Model): - """Describes the resource range. - - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int - """ - - _attribute_map = { - 'min': {'key': 'min', 'type': 'int'}, - 'max': {'key': 'max', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRange, self).__init__(**kwargs) - self.min = kwargs.get('min', None) - self.max = kwargs.get('max', 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.v2019_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 - """ - - _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'}, - } - - 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) - - -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.v2019_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.v2019_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.v2019_03_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2019_03_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2019_03_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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 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 Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', 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.v2019_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 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.v2019_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.v2019_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.v2019_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 TargetRegion(msrest.serialization.Model): - """Describes the target region information. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'regional_replica_count': {'key': 'regionalReplicaCount', 'type': 'int'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetRegion, self).__init__(**kwargs) - self.name = kwargs['name'] - self.regional_replica_count = kwargs.get('regional_replica_count', None) - self.storage_account_type = kwargs.get('storage_account_type', 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ThrottledRequestsInput, self).__init__(**kwargs) - - -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.v2019_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.v2019_03_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2019_03_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_03_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2019_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.v2019_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: An enum describing the unit of usage measurement. Has constant 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.v2019_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 UserArtifactManage(msrest.serialization.Model): - """UserArtifactManage. - - All required parameters must be populated in order to send to Azure. - - :param install: Required. Required. The path and arguments to install the gallery application. - This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. - This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not - present, then update operation will invoke remove command on the previous version and install - command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str - """ - - _validation = { - 'install': {'required': True}, - 'remove': {'required': True}, - } - - _attribute_map = { - 'install': {'key': 'install', 'type': 'str'}, - 'remove': {'key': 'remove', 'type': 'str'}, - 'update': {'key': 'update', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactManage, self).__init__(**kwargs) - self.install = kwargs['install'] - self.remove = kwargs['remove'] - self.update = kwargs.get('update', None) - - -class UserArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must - be a readable storage page blob. - :type default_configuration_link: str - """ - - _validation = { - 'media_link': {'required': True}, - } - - _attribute_map = { - 'media_link': {'key': 'mediaLink', 'type': 'str'}, - 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactSource, self).__init__(**kwargs) - self.media_link = kwargs['media_link'] - self.default_configuration_link = kwargs.get('default_configuration_link', 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.v2019_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.v2019_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.v2019_03_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_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. :code:`
    `:code:`
    `This - property cannot exist along with a non-null properties.virtualMachineScaleSet reference. - :type availability_set: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_03_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. Only - supported value is 'Deallocate'. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. - Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or - ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_03_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - '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'}, - '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'}, - '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'}, - } - - 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.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.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.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2019_03_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_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 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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2019_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'}, - '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.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.v2019_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.v2019_03_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_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.v2019_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2019_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.v2019_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.v2019_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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2019_03_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2019_03_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2019_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.v2019_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.v2019_03_01.models.HyperVGenerationTypes - """ - - _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}'}, - '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'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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.v2019_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.v2019_03_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2019_03_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView] - :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.v2019_03_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] - """ - - _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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2019_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 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 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.v2019_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.v2019_03_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2019_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. - :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.v2019_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.v2019_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.v2019_03_01.models.ScaleInPolicy - """ - - _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]'}, - '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'}, - 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, - 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, - } - - 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.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.additional_capabilities = kwargs.get('additional_capabilities', None) - self.scale_in_policy = kwargs.get('scale_in_policy', 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.v2019_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.v2019_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.v2019_03_01.models.VirtualMachineScaleSetManagedDiskParameters - """ - - _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'}, - } - - 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) - - -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 - :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: 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', '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'}, - '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.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.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.v2019_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.v2019_03_01.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('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.v2019_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.v2019_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.v2019_03_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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 load balancer. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2019_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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. 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. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes - """ - - _attribute_map = { - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) - self.storage_account_type = kwargs.get('storage_account_type', 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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2019_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'}, - '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.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.v2019_03_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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.v2019_03_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_03_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2019_03_01.models.SubResource - """ - - _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'}, - } - - 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) - - -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.v2019_03_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_03_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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. - - :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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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.v2019_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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2019_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'}, - '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.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.v2019_03_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_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.v2019_03_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2019_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.v2019_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.v2019_03_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2019_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.v2019_03_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2019_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 low priority VMSS. - :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. - :type billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - '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'}, - } - - 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.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) - - -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.v2019_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.v2019_03_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2019_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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: - ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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.v2019_03_01.models.VirtualMachineScaleSetVMProtectionPolicy - """ - - _validation = { - '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 = { - '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'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.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) - - -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.v2019_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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2019_03_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2019_03_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2019_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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.v2019_03_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2019_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.v2019_03_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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.v2019_03_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a Azure Spot - scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values - include: "Deallocate", "Delete". - :type eviction_policy: str or - ~azure.mgmt.compute.v2019_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.v2019_03_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - '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'}, - } - - 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.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) - - -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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2019_03_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_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. :code:`
    `:code:`
    `This - property cannot exist along with a non-null properties.virtualMachineScaleSet reference. - :type availability_set: ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_03_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. Only - supported value is 'Deallocate'. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. - Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or - ~azure.mgmt.compute.v2019_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.v2019_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.v2019_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.v2019_03_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - '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'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.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.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': '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". - :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.v2019_03_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2019_03_01.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2019_03_01.models.WinRMListener] - """ - - _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 listener. :code:`
    `:code:`
    ` Possible values - are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: - "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2019_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2019_03_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py index 1166f988a132..fc7958de0284 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,11 +44,11 @@ def __init__( 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -59,6 +61,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -66,21 +75,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2019_03_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2019_03_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -99,6 +108,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2019_03_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -109,9 +135,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -124,6 +150,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -131,16 +162,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_03_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_03_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2019_03_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2019_03_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -161,6 +192,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2019_03_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2019_03_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -172,12 +215,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -194,6 +237,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -203,16 +254,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -227,6 +278,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -237,9 +300,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -256,6 +319,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -263,15 +331,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -286,6 +354,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -304,10 +383,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -332,6 +411,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -353,25 +438,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_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.v2019_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: + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :ivar 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.v2019_03_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ @@ -410,6 +495,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -424,11 +531,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -447,6 +554,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -455,8 +569,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -469,6 +583,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -478,20 +596,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2019_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.v2019_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :ivar 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.v2019_03_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ @@ -521,6 +639,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -533,7 +668,7 @@ def __init__( 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. + :ivar 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 @@ -545,7 +680,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -558,6 +693,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -565,11 +715,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -584,6 +734,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -619,6 +776,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -646,6 +805,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -691,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -707,28 +870,28 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource Manager identifier of + :vartype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption + :ivar storage_account_id: If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long + :vartype upload_size_bytes: long """ _validation = { @@ -757,6 +920,27 @@ def __init__( upload_size_bytes: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption + :keyword storage_account_id: If createOption is Import, the Azure Resource Manager identifier + of the storage account containing the blob to import as a disk. Required only if the blob is in + a different subscription. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -772,44 +956,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2019_03_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :ivar 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.v2019_03_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :ivar 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.v2019_03_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_03_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :ivar 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.v2019_03_01.models.ManagedDiskParameters - :param to_be_detached: Specifies whether the data disk is in process of detachment from the + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype to_be_detached: bool """ _validation = { @@ -845,6 +1029,46 @@ def __init__( to_be_detached: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -880,6 +1104,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -897,29 +1123,29 @@ class DedicatedHost(Resource): :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.v2019_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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2019_03_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2019_03_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2019_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. @@ -970,6 +1196,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2019_03_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -985,11 +1233,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -1004,6 +1252,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -1012,9 +1267,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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.v2019_03_01.models.DedicatedHostAllocatableVM] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1027,6 +1283,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1044,16 +1306,16 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2019_03_01.models.SubResourceReadOnly] """ @@ -1087,6 +1349,18 @@ def __init__( platform_fault_domain_count: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1098,11 +1372,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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.v2019_03_01.models.DedicatedHostGroup] - :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1121,6 +1395,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1131,14 +1412,14 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2019_03_01.models.SubResourceReadOnly] """ @@ -1163,6 +1444,16 @@ def __init__( platform_fault_domain_count: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1177,10 +1468,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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.v2019_03_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2019_03_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ _validation = { @@ -1200,6 +1492,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2019_03_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -1211,11 +1510,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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.v2019_03_01.models.DedicatedHost] - :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1234,6 +1533,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1244,24 +1550,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2019_03_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2019_03_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2019_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. @@ -1300,6 +1606,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2019_03_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -1314,11 +1637,11 @@ def __init__( 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 + :ivar 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.v2019_03_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_03_01.models.BootDiagnostics """ _attribute_map = { @@ -1331,6 +1654,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_03_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -1338,9 +1668,9 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2019_03_01.models.DiffDiskOptions + :vartype option: str or ~azure.mgmt.compute.v2019_03_01.models.DiffDiskOptions """ _attribute_map = { @@ -1353,6 +1683,11 @@ def __init__( option: Optional[Union[str, "DiffDiskOptions"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2019_03_01.models.DiffDiskOptions + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option @@ -1360,8 +1695,8 @@ def __init__( class Disallowed(msrest.serialization.Model): """Describes the disallowed disk types. - :param disk_types: A list of disk types. - :type disk_types: list[str] + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] """ _attribute_map = { @@ -1374,6 +1709,10 @@ def __init__( disk_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ super(Disallowed, self).__init__(**kwargs) self.disk_types = disk_types @@ -1391,49 +1730,49 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: int + :vartype disk_m_bps_read_write: int :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2019_03_01.models.DiskState @@ -1491,6 +1830,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: int + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -1512,13 +1886,13 @@ def __init__( 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -1535,6 +1909,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -1544,13 +1927,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2019_03_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2019_03_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -1567,6 +1951,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2019_03_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -1578,11 +1972,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1601,6 +1995,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1611,9 +2012,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -1633,6 +2034,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1641,29 +2047,29 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: int + :vartype disk_m_bps_read_write: int """ _attribute_map = { @@ -1688,6 +2094,31 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: int + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1703,18 +2134,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -1735,6 +2166,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -1744,11 +2189,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -1763,6 +2208,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -1781,15 +2234,15 @@ class Gallery(Resource): :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 description: The description of this Shared Image Gallery resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -1824,6 +2277,17 @@ def __init__( identifier: Optional["GalleryIdentifier"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryIdentifier + """ super(Gallery, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -1843,27 +2307,27 @@ class GalleryApplication(Resource): :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 description: The description of this gallery Application Definition resource. This + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes """ _validation = { @@ -1900,6 +2364,30 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + """ super(GalleryApplication, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -1914,11 +2402,11 @@ class GalleryApplicationList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application + :ivar value: Required. A list of Gallery Applications. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] + :ivar next_link: The uri to fetch the next page of Application Definitions in the Application Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1937,6 +2425,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Gallery Applications. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] + :keyword next_link: The uri to fetch the next page of Application Definitions in the + Application Gallery. Call ListNext() with this to fetch the next page of gallery Application + Definitions. + :paramtype next_link: str + """ super(GalleryApplicationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1955,12 +2451,12 @@ class GalleryApplicationVersion(Resource): :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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -1998,6 +2494,15 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2009,11 +2514,11 @@ class GalleryApplicationVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call + :ivar value: Required. A list of gallery Application Versions. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] + :ivar next_link: The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2032,6 +2537,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Application Versions. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] + :keyword next_link: The uri to fetch the next page of gallery Application Versions. Call + ListNext() with this to fetch the next page of gallery Application Versions. + :paramtype next_link: str + """ super(GalleryApplicationVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2042,24 +2554,24 @@ class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType """ _validation = { @@ -2085,6 +2597,25 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + """ super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) self.target_regions = target_regions self.replica_count = replica_count @@ -2101,30 +2632,30 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactManage + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool """ _validation = { @@ -2157,6 +2688,32 @@ def __init__( enable_health_check: Optional[bool] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactSource + :keyword manage_actions: + :paramtype manage_actions: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactManage + :keyword enable_health_check: Optional. Whether or not this application reports health. + :paramtype enable_health_check: bool + """ super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source self.manage_actions = manage_actions @@ -2168,8 +2725,8 @@ class GalleryArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2019_03_01.models.ManagedArtifact + :ivar managed_image: Required. The managed artifact. + :vartype managed_image: ~azure.mgmt.compute.v2019_03_01.models.ManagedArtifact """ _validation = { @@ -2186,6 +2743,10 @@ def __init__( managed_image: "ManagedArtifact", **kwargs ): + """ + :keyword managed_image: Required. The managed artifact. + :paramtype managed_image: ~azure.mgmt.compute.v2019_03_01.models.ManagedArtifact + """ super(GalleryArtifactSource, self).__init__(**kwargs) self.managed_image = managed_image @@ -2216,6 +2777,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryDiskImage, self).__init__(**kwargs) self.size_in_gb = None self.host_caching = None @@ -2253,6 +2816,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryDataDiskImage, self).__init__(**kwargs) self.lun = None @@ -2279,6 +2844,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryIdentifier, self).__init__(**kwargs) self.unique_name = None @@ -2296,41 +2863,41 @@ class GalleryImage(Resource): :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 description: The description of this gallery Image Definition resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Image Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery Image Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2019_03_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_03_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_03_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + :vartype os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery Image Definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery Image Definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2019_03_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2019_03_01.models.Disallowed + :ivar purchase_plan: Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_03_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2019_03_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2383,6 +2950,43 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Image Definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Image Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes + :keyword end_of_life_date: The end of life date of the gallery Image Definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery Image Definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2019_03_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2019_03_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2019_03_01.models.Disallowed + :keyword purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2019_03_01.models.ImagePurchasePlan + """ super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -2403,12 +3007,12 @@ class GalleryImageIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str + :ivar publisher: Required. The name of the gallery Image Definition publisher. + :vartype publisher: str + :ivar offer: Required. The name of the gallery Image Definition offer. + :vartype offer: str + :ivar sku: Required. The name of the gallery Image Definition SKU. + :vartype sku: str """ _validation = { @@ -2431,6 +3035,14 @@ def __init__( sku: str, **kwargs ): + """ + :keyword publisher: Required. The name of the gallery Image Definition publisher. + :paramtype publisher: str + :keyword offer: Required. The name of the gallery Image Definition offer. + :paramtype offer: str + :keyword sku: Required. The name of the gallery Image Definition SKU. + :paramtype sku: str + """ super(GalleryImageIdentifier, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -2442,11 +3054,11 @@ class GalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image + :ivar value: Required. A list of Shared Image Gallery images. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] + :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2465,6 +3077,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Shared Image Gallery images. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] + :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. + :paramtype next_link: str + """ super(GalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2483,12 +3102,12 @@ class GalleryImageVersion(Resource): :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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery Image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -2531,6 +3150,15 @@ def __init__( publishing_profile: Optional["GalleryImageVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery Image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionPublishingProfile + """ super(GalleryImageVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2543,11 +3171,11 @@ class GalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str + :ivar value: Required. A list of gallery Image Versions. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] + :ivar next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() with + this to fetch the next page of gallery Image Versions. + :vartype next_link: str """ _validation = { @@ -2566,6 +3194,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Image Versions. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] + :keyword next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() + with this to fetch the next page of gallery Image Versions. + :paramtype next_link: str + """ super(GalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2578,26 +3213,26 @@ class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase) All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_03_01.models.GalleryArtifactSource + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2019_03_01.models.GalleryArtifactSource """ _validation = { @@ -2626,6 +3261,28 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_03_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2019_03_01.models.GalleryArtifactSource + """ super(GalleryImageVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source @@ -2655,6 +3312,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) self.os_disk_image = None self.data_disk_images = None @@ -2665,11 +3324,11 @@ class GalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + :ivar value: Required. A list of galleries. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.Gallery] + :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2688,6 +3347,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of galleries. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.Gallery] + :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :paramtype next_link: str + """ super(GalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2719,6 +3385,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryOSDiskImage, self).__init__(**kwargs) @@ -2727,10 +3395,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -2750,6 +3418,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -2758,7 +3432,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -2804,7 +3478,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2019_03_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -2817,6 +3491,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -2834,19 +3557,20 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes """ _validation = { @@ -2879,6 +3603,20 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -2891,30 +3629,31 @@ class ImageDataDisk(msrest.serialization.Model): 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 + :ivar 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 snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_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 + :vartype lun: int + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_03_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes """ _validation = { @@ -2943,6 +3682,33 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + """ super(ImageDataDisk, self).__init__(**kwargs) self.lun = lun self.snapshot = snapshot @@ -2958,12 +3724,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -2982,6 +3748,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -2992,11 +3766,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2019_03_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3015,6 +3789,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3025,33 +3806,34 @@ class ImageOSDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. This property allows you to specify the type of the OS that is + :ivar 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.v2019_03_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_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 + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_03_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :ivar 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. + :vartype disk_size_gb: int + :ivar storage_account_type: Specifies the storage account type for the managed disk. UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes """ _validation = { @@ -3083,6 +3865,37 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemStateTypes + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. + UltraSSD_LRS cannot be used with OS Disk. Possible values include: "Standard_LRS", + "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + """ super(ImageOSDisk, self).__init__(**kwargs) self.os_type = os_type self.os_state = os_state @@ -3097,12 +3910,12 @@ def __init__( class ImagePurchasePlan(msrest.serialization.Model): """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str """ _attribute_map = { @@ -3119,6 +3932,14 @@ def __init__( product: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product ID. + :paramtype product: str + """ super(ImagePurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3128,8 +3949,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -3142,6 +3963,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -3149,21 +3974,21 @@ def __init__( 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. - :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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype version: str """ _attribute_map = { @@ -3184,6 +4009,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -3194,19 +4036,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2019_03_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_03_01.models.ImageOSDisk + :ivar 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.v2019_03_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2019_03_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -3223,6 +4065,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_03_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2019_03_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -3234,17 +4091,18 @@ class ImageUpdate(UpdateResource): 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.v2019_03_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes """ _validation = { @@ -3268,6 +4126,18 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -3278,10 +4148,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -3296,6 +4166,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -3304,16 +4180,16 @@ def __init__( 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.v2019_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2019_03_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -3334,6 +4210,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2019_03_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -3347,10 +4235,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -3370,6 +4258,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -3380,10 +4274,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -3403,6 +4297,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -3413,10 +4313,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2019_03_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SubResource """ _validation = { @@ -3436,6 +4336,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -3446,10 +4352,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2019_03_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SubResource """ _validation = { @@ -3469,6 +4375,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -3477,16 +4389,16 @@ def __init__( 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 + :ivar 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.v2019_03_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2019_03_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool """ _attribute_map = { @@ -3503,6 +4415,18 @@ def __init__( provision_vm_agent: Optional[bool] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2019_03_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -3514,11 +4438,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2019_03_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3537,6 +4461,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3547,19 +4478,19 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -3588,6 +4519,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -3618,6 +4564,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -3643,6 +4591,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -3650,23 +4600,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2019_03_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -3691,6 +4641,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2019_03_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -3706,8 +4675,8 @@ class ManagedArtifact(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The managed artifact id. - :type id: str + :ivar id: Required. The managed artifact id. + :vartype id: str """ _validation = { @@ -3724,6 +4693,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ super(ManagedArtifact, self).__init__(**kwargs) self.id = id @@ -3731,12 +4704,13 @@ def __init__( 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: + :ivar id: Resource Id. + :vartype id: str + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes """ _attribute_map = { @@ -3751,6 +4725,15 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type @@ -3758,11 +4741,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -3777,6 +4760,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -3784,9 +4774,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2019_03_01.models.NetworkInterfaceReference] """ @@ -3800,6 +4790,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2019_03_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -3809,48 +4805,48 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2019_03_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2019_03_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2019_03_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :ivar 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.v2019_03_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :ivar 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.v2019_03_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_03_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2019_03_01.models.DiffDiskSettings + :ivar 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.v2019_03_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :ivar 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.v2019_03_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.ManagedDiskParameters """ _validation = { @@ -3887,6 +4883,50 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2019_03_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2019_03_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -3906,9 +4946,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes """ _validation = { @@ -3925,6 +4965,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -3932,29 +4977,28 @@ def __init__( class OSProfile(msrest.serialization.Model): """Specifies the operating system settings for the virtual machine. - :param computer_name: Specifies the host OS name of the virtual machine. + :ivar 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:`
    ` **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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -3969,34 +5013,33 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration + :ivar 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.v2019_03_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar require_guest_provision_signal: Specifies whether the guest provision signal is required from the virtual machine. - :type require_guest_provision_signal: bool + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -4025,6 +5068,73 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword require_guest_provision_signal: Specifies whether the guest provision signal is + required from the virtual machine. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -4040,15 +5150,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -4067,6 +5177,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4087,15 +5208,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -4138,6 +5259,18 @@ def __init__( proximity_placement_group_type: Optional[Union[str, "ProximityPlacementGroupType"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupType + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -4150,10 +5283,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2019_03_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -4172,6 +5305,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4180,8 +5319,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -4194,6 +5333,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -4202,13 +5345,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -4231,6 +5374,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -4240,10 +5392,10 @@ def __init__( class RecommendedMachineConfiguration(msrest.serialization.Model): """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange """ _attribute_map = { @@ -4258,6 +5410,12 @@ def __init__( memory: Optional["ResourceRange"] = None, **kwargs ): + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2019_03_01.models.ResourceRange + """ super(RecommendedMachineConfiguration, self).__init__(**kwargs) self.v_cp_us = v_cp_us self.memory = memory @@ -4289,6 +5447,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -4328,6 +5488,8 @@ def __init__( self, **kwargs ): + """ + """ super(RegionalReplicationStatus, self).__init__(**kwargs) self.region = None self.state = None @@ -4363,6 +5525,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = None @@ -4373,22 +5537,22 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 interval_length: Required. Interval value in minutes used to create LogAnalytics call + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar 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.v2019_03_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2019_03_01.models.IntervalInMins """ _validation = { @@ -4420,6 +5584,24 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2019_03_01.models.IntervalInMins + """ 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, **kwargs) self.interval_length = interval_length @@ -4427,10 +5609,10 @@ def __init__( class ResourceRange(msrest.serialization.Model): """Describes the resource range. - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int """ _attribute_map = { @@ -4445,6 +5627,12 @@ def __init__( max: Optional[int] = None, **kwargs ): + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ super(ResourceRange, self).__init__(**kwargs) self.min = min self.max = max @@ -4480,6 +5668,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -4489,26 +5679,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -4533,6 +5723,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -4574,6 +5786,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -4616,6 +5830,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -4636,10 +5852,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2019_03_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -4681,6 +5897,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -4693,17 +5915,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_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 + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -4732,6 +5954,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -4745,21 +5980,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_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.v2019_03_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2019_03_01.models.RunCommandParameterDefinition] """ _validation = { @@ -4793,6 +6028,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2019_03_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -4803,13 +6056,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2019_03_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2019_03_01.models.RunCommandInputParameter] """ _validation = { @@ -4830,6 +6083,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2019_03_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -4841,10 +6103,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -4864,6 +6126,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -4874,11 +6142,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2019_03_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4897,6 +6165,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4907,14 +6182,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -4938,6 +6213,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -4948,8 +6233,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -4962,6 +6247,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -4969,7 +6258,7 @@ def __init__( 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. + :ivar 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 @@ -4983,7 +6272,7 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetScaleInRules] """ @@ -4997,6 +6286,24 @@ def __init__( rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetScaleInRules] + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules @@ -5004,9 +6311,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2019_03_01.models.TerminateNotificationProfile """ @@ -5020,6 +6327,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2019_03_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -5027,14 +6340,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -5051,6 +6364,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5070,42 +6393,42 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool + :vartype incremental: bool """ _validation = { @@ -5154,6 +6477,34 @@ def __init__( incremental: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -5174,11 +6525,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -5197,6 +6548,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5207,9 +6565,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -5229,6 +6587,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -5237,20 +6600,20 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection """ @@ -5272,6 +6635,23 @@ def __init__( encryption_settings_collection: Optional["EncryptionSettingsCollection"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -5283,8 +6663,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -5297,6 +6677,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -5304,8 +6688,8 @@ def __init__( 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.v2019_03_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2019_03_01.models.SshPublicKey] """ _attribute_map = { @@ -5318,6 +6702,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2019_03_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -5325,15 +6713,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -5348,6 +6736,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -5356,21 +6755,21 @@ def __init__( 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 + :ivar 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.v2019_03_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageReference + :ivar 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.v2019_03_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_03_01.models.OSDisk + :ivar 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.v2019_03_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2019_03_01.models.DataDisk] """ _attribute_map = { @@ -5387,6 +6786,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_03_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2019_03_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5414,6 +6830,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -5423,14 +6841,14 @@ class TargetRegion(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per + :ivar name: Required. The name of the region. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. + :vartype regional_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType """ _validation = { @@ -5451,6 +6869,17 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword name: Required. The name of the region. + :paramtype name: str + :keyword regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :paramtype regional_replica_count: int + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType + """ super(TargetRegion, self).__init__(**kwargs) self.name = name self.regional_replica_count = regional_replica_count @@ -5460,13 +6889,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -5481,6 +6910,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -5491,19 +6929,19 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -5532,6 +6970,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ 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, **kwargs) @@ -5565,6 +7018,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -5613,6 +7068,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -5652,6 +7109,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -5661,19 +7120,19 @@ def __init__( 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.v2019_03_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2019_03_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.AutomaticOSUpgradePolicy """ @@ -5691,6 +7150,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2019_03_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2019_03_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -5706,12 +7181,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2019_03_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2019_03_01.models.UsageName """ _validation = { @@ -5738,6 +7213,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2019_03_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -5747,10 +7230,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -5765,6 +7248,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -5775,16 +7264,16 @@ class UserArtifactManage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param install: Required. Required. The path and arguments to install the gallery application. + :ivar install: Required. Required. The path and arguments to install the gallery application. This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. + :vartype install: str + :ivar remove: Required. Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not + :vartype remove: str + :ivar update: Optional. The path and arguments to update the gallery application. If not present, then update operation will invoke remove command on the previous version and install command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str + :vartype update: str """ _validation = { @@ -5806,6 +7295,18 @@ def __init__( update: Optional[str] = None, **kwargs ): + """ + :keyword install: Required. Required. The path and arguments to install the gallery + application. This is limited to 4096 characters. + :paramtype install: str + :keyword remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :paramtype remove: str + :keyword update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :paramtype update: str + """ super(UserArtifactManage, self).__init__(**kwargs) self.install = install self.remove = remove @@ -5817,12 +7318,12 @@ class UserArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + :ivar media_link: Required. Required. The mediaLink of the artifact, must be a readable storage + page blob. + :vartype media_link: str + :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. - :type default_configuration_link: str + :vartype default_configuration_link: str """ _validation = { @@ -5841,6 +7342,14 @@ def __init__( default_configuration_link: Optional[str] = None, **kwargs ): + """ + :keyword media_link: Required. Required. The mediaLink of the artifact, must be a readable + storage page blob. + :paramtype media_link: str + :keyword default_configuration_link: Optional. The defaultConfigurationLink of the artifact, + must be a readable storage page blob. + :paramtype default_configuration_link: str + """ super(UserArtifactSource, self).__init__(**kwargs) self.media_link = media_link self.default_configuration_link = default_configuration_link @@ -5871,6 +7380,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -5879,21 +7390,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -5908,6 +7419,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -5916,12 +7444,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2019_03_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2019_03_01.models.VaultCertificate] """ _attribute_map = { @@ -5936,6 +7464,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2019_03_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -5944,8 +7480,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -5958,6 +7494,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -5975,37 +7515,37 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_03_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :ivar 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 @@ -6016,39 +7556,38 @@ class VirtualMachine(Resource): :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. :code:`
    `:code:`
    `This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. - :type availability_set: ~azure.mgmt.compute.v2019_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 + :vartype availability_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar 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.v2019_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar 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.v2019_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.v2019_03_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. Only + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. Only supported value is 'Deallocate'. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2019_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.v2019_03_01.models.SubResource + :vartype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6056,7 +7595,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -6126,6 +7665,85 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :keyword 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. :code:`
    `:code:`
    `This + property cannot exist along with a non-null properties.virtualMachineScaleSet reference. + :paramtype availability_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. + Only supported value is 'Deallocate'. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + Possible values include: "Deallocate", "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -6153,13 +7771,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6176,6 +7794,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -6187,13 +7814,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -6216,6 +7843,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -6227,8 +7863,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -6260,6 +7896,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -6280,33 +7920,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2019_03_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -6349,6 +7990,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -6364,12 +8033,12 @@ def __init__( 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.v2019_03_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus """ _attribute_map = { @@ -6386,6 +8055,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -6405,23 +8082,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -6456,6 +8133,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -6467,16 +8163,16 @@ def __init__( 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.v2019_03_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6497,6 +8193,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -6508,8 +8216,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -6522,6 +8230,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -6529,26 +8241,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -6575,6 +8287,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -6606,6 +8340,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -6621,15 +8357,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2019_03_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2019_03_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_03_01.models.UserAssignedIdentitiesValue] """ @@ -6652,6 +8388,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2019_03_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2019_03_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -6664,16 +8412,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -6697,6 +8445,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -6708,29 +8468,30 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2019_03_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2019_03_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2019_03_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2019_03_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2019_03_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2019_03_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2019_03_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes """ _validation = { @@ -6764,6 +8525,33 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2019_03_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2019_03_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2019_03_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2019_03_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationTypes + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -6775,38 +8563,38 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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.v2019_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.v2019_03_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2019_03_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2019_03_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_03_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6843,6 +8631,41 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2019_03_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_03_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -6864,11 +8687,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2019_03_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6887,6 +8710,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6895,9 +8725,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -6910,6 +8740,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -6927,61 +8762,61 @@ class VirtualMachineScaleSet(Resource): :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.v2019_03_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :ivar 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.v2019_03_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2019_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool - :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2019_03_01.models.SubResource - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar 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.v2019_03_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :ivar 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.v2019_03_01.models.ScaleInPolicy + :vartype scale_in_policy: ~azure.mgmt.compute.v2019_03_01.models.ScaleInPolicy """ _validation = { @@ -7040,6 +8875,61 @@ def __init__( scale_in_policy: Optional["ScaleInPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2019_03_01.models.ScaleInPolicy + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -7065,30 +8955,30 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2019_03_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -7119,6 +9009,33 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -7136,31 +9053,31 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: str - :param force_update_tag: If a value is provided and is different from the previous value, the + :ivar name: The name of the extension. + :vartype name: str + :ivar 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: 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -7196,6 +9113,31 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.force_update_tag = force_update_tag @@ -7214,11 +9156,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2019_03_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7237,6 +9179,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7245,8 +9194,9 @@ def __init__( 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.v2019_03_01.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -7259,6 +9209,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -7274,17 +9229,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2019_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: + :vartype type: str or ~azure.mgmt.compute.v2019_03_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -7307,6 +9261,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2019_03_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -7339,6 +9307,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -7355,8 +9325,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] """ _validation = { @@ -7376,6 +9346,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -7404,6 +9378,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -7413,39 +9389,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2019_03_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2019_03_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2019_03_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :ivar 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 load balancer. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :ivar 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 load balancer. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] """ _validation = { @@ -7480,6 +9457,43 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2019_03_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -7495,10 +9509,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -7513,6 +9527,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -7523,11 +9543,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2019_03_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2019_03_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7546,6 +9567,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2019_03_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7556,11 +9585,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2019_03_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7579,6 +9608,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7589,11 +9625,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2019_03_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7612,6 +9648,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7622,11 +9665,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2019_03_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7645,6 +9688,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7653,11 +9703,12 @@ def __init__( 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. 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. Possible values include: + :ivar storage_account_type: 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. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes """ _attribute_map = { @@ -7670,6 +9721,14 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_03_01.models.StorageAccountTypes + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type @@ -7679,26 +9738,26 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -7729,6 +9788,28 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -7742,8 +9823,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -7756,6 +9837,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -7763,12 +9848,12 @@ def __init__( 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 + :ivar 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.v2019_03_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -7784,6 +9869,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -7794,43 +9888,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2019_03_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_03_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :ivar 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.v2019_03_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2019_03_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2019_03_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -7866,6 +9960,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2019_03_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -7882,25 +10016,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -7915,27 +10048,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration + :ivar 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.v2019_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.v2019_03_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] """ _attribute_map = { @@ -7960,6 +10093,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -7975,17 +10164,17 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2019_03_01.models.SubResource """ _validation = { @@ -8010,6 +10199,19 @@ def __init__( public_ip_prefix: Optional["SubResource"] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2019_03_01.models.SubResource + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -8023,10 +10225,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -8043,6 +10245,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -8050,9 +10258,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -8065,19 +10273,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -8092,6 +10305,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -8125,6 +10347,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -8166,6 +10390,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -8176,21 +10402,22 @@ def __init__( 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 + :ivar 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.v2019_03_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageReference + :ivar 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.v2019_03_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2019_03_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -8207,6 +10434,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -8216,45 +10461,45 @@ def __init__( 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.v2019_03_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2019_03_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2019_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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.v2019_03_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :ivar 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.v2019_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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2019_03_01.models.ScaleInPolicy + :ivar 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.v2019_03_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource """ _attribute_map = { @@ -8291,6 +10536,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2019_03_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2019_03_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_03_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2019_03_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -8309,34 +10597,34 @@ def __init__( class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): """Describes a virtual machine scale set network profile's IP configuration. - :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.v2019_03_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2019_03_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2019_03_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_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.v2019_03_01.models.SubResource] """ _attribute_map = { @@ -8367,6 +10655,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2019_03_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2019_03_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -8382,25 +10702,25 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -8427,6 +10747,27 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -8440,12 +10781,12 @@ def __init__( 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 + :ivar 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.v2019_03_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -8461,6 +10802,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2019_03_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -8469,23 +10819,23 @@ def __init__( 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.v2019_03_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2019_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: + :vartype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -8509,6 +10859,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2019_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_03_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -8521,14 +10891,14 @@ def __init__( 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.v2019_03_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] """ _attribute_map = { @@ -8547,6 +10917,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_03_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_03_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2019_03_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -8557,12 +10937,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -8580,6 +10960,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -8589,12 +10978,13 @@ def __init__( 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.v2019_03_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -8611,6 +11001,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2019_03_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -8620,26 +11019,28 @@ def __init__( 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.v2019_03_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2019_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 low priority VMSS. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar billing_profile: Specifies the billing related details of a low priority VMSS. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. - :type billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -8666,6 +11067,30 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a low priority VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -8690,20 +11115,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2019_03_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2019_03_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -8716,26 +11141,26 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile + :ivar 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.v2019_03_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :ivar 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 @@ -8745,10 +11170,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2019_03_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2019_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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -8756,12 +11181,12 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMProtectionPolicy """ @@ -8827,6 +11252,61 @@ def __init__( protection_policy: Optional["VirtualMachineScaleSetVMProtectionPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMProtectionPolicy + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -8876,6 +11356,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -8884,10 +11366,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -8900,6 +11382,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -8909,8 +11397,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -8927,6 +11415,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -8936,34 +11428,34 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2019_03_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2019_03_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2019_03_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_03_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -8999,6 +11491,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2019_03_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2019_03_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_03_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_03_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -9018,11 +11538,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9041,6 +11561,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9049,8 +11576,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -9064,6 +11591,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -9071,24 +11603,24 @@ def __init__( 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.v2019_03_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_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: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -9096,21 +11628,22 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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. + :vartype license_type: str + :ivar 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.v2019_03_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for virtual machines in a Azure Spot - scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values - include: "Deallocate", "Delete". - :type eviction_policy: str or + :vartype priority: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for virtual machines in a Azure Spot scale + set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: + "Deallocate", "Delete". + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :ivar 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.v2019_03_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -9141,6 +11674,49 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for virtual machines in a Azure Spot + scale set. :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values + include: "Deallocate", "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2019_03_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -9157,13 +11733,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -9178,6 +11754,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -9186,20 +11771,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -9222,6 +11807,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -9234,8 +11835,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSize] """ _attribute_map = { @@ -9248,6 +11849,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -9277,6 +11882,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -9287,33 +11894,33 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_03_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :ivar 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 @@ -9324,39 +11931,38 @@ class VirtualMachineUpdate(UpdateResource): :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. :code:`
    `:code:`
    `This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. - :type availability_set: ~azure.mgmt.compute.v2019_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 + :vartype availability_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar 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.v2019_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar 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.v2019_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.v2019_03_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. Only + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. Only supported value is 'Deallocate'. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Deallocate", "Delete". - :type eviction_policy: str or + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2019_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.v2019_03_01.models.SubResource + :vartype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2019_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.v2019_03_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -9364,7 +11970,7 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -9423,6 +12029,83 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_03_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_03_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2019_03_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_03_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_03_01.models.DiagnosticsProfile + :keyword 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. :code:`
    `:code:`
    `This + property cannot exist along with a non-null properties.virtualMachineScaleSet reference. + :paramtype availability_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2019_03_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine. + Only supported value is 'Deallocate'. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + Possible values include: "Deallocate", "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_03_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2019_03_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -9449,11 +12132,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -9466,6 +12149,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -9473,24 +12163,24 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". - :type time_zone: str - :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + :vartype enable_automatic_updates: bool + :ivar time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2019_03_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2019_03_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2019_03_01.models.WinRMConfiguration """ _attribute_map = { @@ -9511,6 +12201,27 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard + Time". + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2019_03_01.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2019_03_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -9522,8 +12233,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2019_03_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2019_03_01.models.WinRMListener] """ _attribute_map = { @@ -9536,6 +12247,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2019_03_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -9543,18 +12258,18 @@ def __init__( class WinRMListener(msrest.serialization.Model): """Describes Protocol and thumbprint of Windows Remote Management listener. - :param protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + :ivar protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.compute.v2019_03_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2019_03_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -9569,6 +12284,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of listener. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2019_03_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py index 68a8172e0d58..3d1381d95fc0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2019_03_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2019_03_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py index 4aa308f92ad3..bfe519782e41 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py @@ -5,23 +5,242 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +264,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +292,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +325,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +355,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +384,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +411,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,13 +434,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -262,27 +458,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,22 +482,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -319,35 +509,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -365,22 +551,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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.v2019_03_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -388,34 +577,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -433,6 +617,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py index 27fd1be3413f..700bed5156ae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2019_03_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2019_03_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHost" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -449,7 +616,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -461,30 +629,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -498,15 +655,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -515,8 +674,10 @@ def list_by_host_group( :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.v2019_03_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -524,36 +685,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py index 1a031a2eefa6..83c71864b63c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2019_03_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2019_03_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_03_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py index 1c4cb92b5d97..e96544444544 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py @@ -5,25 +5,206 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleriesOperations(object): """GalleriesOperations operations. @@ -49,43 +230,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -106,16 +276,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Create or update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -127,15 +299,18 @@ def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2019_03_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +322,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,15 +348,16 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> "_models.Gallery": """Retrieves information about a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -204,27 +374,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,41 +398,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -285,13 +436,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -300,15 +452,17 @@ def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -322,21 +476,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,14 +495,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a resource group. :param resource_group_name: The name of the resource group. @@ -370,35 +518,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -416,16 +560,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -438,34 +583,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -483,6 +623,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py index f56804e17dd4..98397a52ca22 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py @@ -5,25 +5,195 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_application_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationVersionsOperations(object): """GalleryApplicationVersionsOperations operations. @@ -49,47 +219,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -110,18 +269,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -139,18 +300,24 @@ def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +331,21 @@ def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,18 +357,19 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": """Retrieves information about a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -235,31 +395,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -273,45 +422,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -324,15 +464,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -348,15 +489,17 @@ def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -372,23 +515,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -400,16 +534,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationVersionList"]: """List gallery Application Versions in a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -421,8 +556,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -430,37 +567,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -478,6 +613,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py index 2fccd124082d..38c1d16e366d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationsOperations(object): """GalleryApplicationsOperations operations. @@ -49,45 +207,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application, 'GalleryApplication') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -108,17 +255,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -135,15 +284,20 @@ def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2019_03_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -156,28 +310,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,16 +336,17 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> "_models.GalleryApplication": """Retrieves information about a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -219,28 +367,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,43 +392,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,14 +432,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application. :param resource_group_name: The name of the resource group. @@ -322,15 +452,17 @@ def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -345,22 +477,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +496,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationList"]: """List gallery Application Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -389,8 +514,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -398,36 +525,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -445,6 +569,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py index a804b29b5728..f49f1a150179 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py @@ -5,25 +5,195 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_image_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImageVersionsOperations(object): """GalleryImageVersionsOperations operations. @@ -49,47 +219,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -110,18 +269,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Create or update a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -142,15 +303,20 @@ def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +330,21 @@ def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,18 +356,19 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": """Retrieves information about a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -234,31 +393,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -272,45 +420,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,15 +462,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -346,15 +486,17 @@ def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -370,23 +512,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -398,16 +531,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageVersionList"]: """List gallery Image Versions in a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -419,8 +553,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -428,37 +564,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -476,6 +610,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py index eb780d465c10..20f03ebb0502 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImagesOperations(object): """GalleryImagesOperations operations. @@ -49,45 +207,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image, 'GalleryImage') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -108,17 +255,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Create or update a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -134,15 +283,19 @@ def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2019_03_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,28 +308,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -188,16 +334,17 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": """Retrieves information about a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -217,28 +364,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -252,43 +389,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -301,14 +429,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image. :param resource_group_name: The name of the resource group. @@ -320,15 +449,17 @@ def begin_delete( :type gallery_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -343,22 +474,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -370,15 +493,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageList"]: """List gallery Image Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -396,36 +520,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -443,6 +564,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py index 64b464d6084d..235decb4c94d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_03_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_03_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py index 35d1c9189f33..5f7b17136791 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py index ac3d6078df43..40b5be824ae0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2019_03_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py index da0c7edad14d..ac7a2dff055b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,242 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +264,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +290,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +323,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +353,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +382,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +409,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,13 +432,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -260,27 +456,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,18 +480,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2019_03_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -313,34 +503,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -358,24 +543,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -383,35 +571,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +613,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py index af115cc1028e..e40c02c62785 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_03_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2019-03-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py index 824153370074..bdab49c27c27 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py index aaf27e34192b..5078a5c3aaa5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2019_03_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extensions_operations.py index e116602f1a63..284dad163cfb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2019_03_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_images_operations.py index 893b3c7a5bac..3f0e8ef8d44a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2019_03_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_run_commands_operations.py index d98109a1ae67..81c77a1052ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py index 8cf334ccb3c6..dddccc1d8caf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +205,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +250,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +274,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +304,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,41 +330,33 @@ def get_long_running_output(pipeline_response): ) 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 _delete_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - vmss_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,14 +369,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -249,15 +388,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -272,22 +413,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -299,17 +432,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -330,30 +464,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,15 +490,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -383,8 +508,10 @@ def list( :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.v2019_03_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -392,36 +519,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +563,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index e585ad2a5cba..55f461915766 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py index 5f121c09ef3e..4cef46a08a06 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,539 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +563,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +606,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +625,22 @@ def begin_reimage( :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.v2019_03_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +653,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +676,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +715,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +735,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +760,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +779,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +818,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +839,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +864,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +883,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +933,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +959,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +985,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,41 +1011,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,14 +1050,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -609,15 +1069,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -632,22 +1094,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -659,17 +1113,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -678,7 +1133,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -690,30 +1146,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -727,16 +1172,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -755,28 +1202,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -790,18 +1227,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -818,8 +1257,10 @@ def list( '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.v2019_03_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -827,42 +1268,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -880,6 +1318,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -887,40 +1326,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2019-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -933,15 +1362,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -958,15 +1388,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -982,22 +1414,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1009,41 +1433,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1056,14 +1472,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1074,15 +1491,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1097,22 +1516,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1124,41 +1535,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1171,14 +1574,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1189,15 +1593,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1212,22 +1618,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1239,41 +1637,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1286,14 +1676,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1305,15 +1696,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1328,22 +1721,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1355,41 +1740,33 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1402,14 +1779,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1420,15 +1798,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1443,22 +1823,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1470,49 +1842,39 @@ def get_long_running_output(pipeline_response): ) 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 _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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1528,17 +1890,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1551,15 +1915,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2019_03_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1572,28 +1940,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1605,4 +1966,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py index fe1150a224e8..e923e6f1f4fd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,852 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +876,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +919,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +941,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +966,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +992,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +1036,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1058,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1083,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,39 +1109,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,13 +1146,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -361,15 +1162,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +1186,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -409,15 +1205,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -434,27 +1231,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,48 +1255,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,14 +1302,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -539,18 +1320,22 @@ def begin_deallocate( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,24 +1347,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,45 +1370,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -642,14 +1413,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -657,18 +1429,22 @@ def begin_delete_instances( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -680,24 +1456,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -709,15 +1479,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -734,27 +1505,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -768,21 +1529,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -790,35 +1555,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,23 +1597,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2019_03_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -860,34 +1624,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,18 +1664,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -925,8 +1685,10 @@ def list_skus( :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.v2019_03_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -934,36 +1696,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -981,18 +1740,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1000,8 +1760,10 @@ def get_os_upgrade_history( :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.v2019_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1009,36 +1771,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,6 +1815,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1063,47 +1823,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1116,15 +1866,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1138,18 +1889,22 @@ def begin_power_off( 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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1162,24 +1917,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1191,48 +1940,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1245,14 +1986,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1260,18 +2002,22 @@ def begin_restart( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1283,24 +2029,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1312,48 +2052,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1366,14 +2098,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1381,18 +2114,22 @@ def begin_start( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1404,24 +2141,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1433,48 +2164,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1487,14 +2210,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1503,18 +2227,22 @@ def begin_redeploy( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1526,24 +2254,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1555,48 +2277,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1609,14 +2323,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1627,18 +2342,22 @@ def begin_perform_maintenance( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1650,24 +2369,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1679,45 +2392,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1730,14 +2435,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1745,18 +2451,22 @@ def begin_update_instances( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1768,24 +2478,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1797,48 +2501,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1851,14 +2547,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1868,18 +2565,22 @@ def begin_reimage( :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.v2019_03_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1891,24 +2592,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1920,48 +2615,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1974,14 +2661,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1990,18 +2678,22 @@ def begin_reimage_all( :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2013,24 +2705,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2042,16 +2728,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2072,28 +2759,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2107,16 +2784,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to true for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2124,7 +2803,8 @@ def convert_to_single_placement_group( :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.v2019_03_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2019_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 @@ -2135,30 +2815,22 @@ def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2170,3 +2842,4 @@ def convert_to_single_placement_group( return cls(pipeline_response, None, {}) convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py index 3e7799c6d24d..6d6236cbd10f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py index 31cbb3d9dd77..71f83fd519f4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py @@ -5,25 +5,717 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +739,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +761,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +803,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +811,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +852,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +875,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_03_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +900,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +926,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +974,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. :param resource_group_name: The name of the resource group. @@ -323,15 +996,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2019_03_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -343,27 +1020,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -375,47 +1046,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -433,16 +1094,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -453,15 +1116,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2019_03_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -473,27 +1140,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -505,39 +1166,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,13 +1203,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -565,15 +1219,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -587,21 +1243,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,23 +1262,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -641,29 +1292,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,15 +1317,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -702,27 +1344,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -736,39 +1368,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,13 +1406,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -797,15 +1423,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -819,21 +1447,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -845,39 +1466,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -890,13 +1503,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -906,15 +1520,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -928,21 +1544,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -954,15 +1563,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """Sets the state of the virtual machine to generalized. :param resource_group_name: The name of the resource group. @@ -979,25 +1589,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1010,20 +1612,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_03_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1031,35 +1636,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1077,22 +1678,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + **kwargs: Any + ) -> 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. :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.v2019_03_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1100,34 +1704,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1145,18 +1744,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1165,8 +1765,10 @@ def list_available_sizes( :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.v2019_03_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1174,36 +1776,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1221,6 +1820,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1228,38 +1828,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2019-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1272,14 +1862,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1293,15 +1884,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1316,21 +1909,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1342,39 +1928,31 @@ def get_long_running_output(pipeline_response): ) 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 _restart_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1387,13 +1965,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1402,15 +1981,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1424,21 +2005,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1450,39 +2024,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1495,13 +2061,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1510,15 +2077,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1532,21 +2101,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1558,39 +2120,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1603,13 +2157,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1618,15 +2173,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1640,21 +2197,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1666,48 +2216,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1720,14 +2262,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1738,15 +2281,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1758,24 +2304,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1787,39 +2327,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1832,13 +2364,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -1847,15 +2380,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1869,21 +2404,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1895,47 +2423,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2019-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1951,16 +2469,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -1971,15 +2491,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2019_03_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1991,27 +2515,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2023,4 +2541,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py index 507de8e1794e..fbc3c6da80b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py @@ -6,73 +6,77 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - +from . import models from ._configuration import ComputeManagementClientConfiguration from .operations import ResourceSkusOperations -from . import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2019_04_01.operations.ResourceSkusOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_skus = ResourceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py index bbd40942fe96..1d23f2385aac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json index d3569701e0b0..e6add6226402 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "resource_skus": "ResourceSkusOperations" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py index 7b81c3374e1d..7a021673f43e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py @@ -6,69 +6,77 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - +from .. import models from ._configuration import ComputeManagementClientConfiguration from .operations import ResourceSkusOperations -from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2019_04_01.aio.operations.ResourceSkusOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_skus = ResourceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py index 583ee3bd3f5b..2f95acbe636f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py index 263e7a0922e6..e86ad9ee74f1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._resource_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, filter: Optional[str] = None, @@ -53,7 +59,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_04_01.models.ResourceSkusResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_04_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] @@ -61,36 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-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') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/__init__.py index 2e117d376ed7..186f1cb989d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/__init__.py @@ -6,26 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCapacity - from ._models_py3 import ResourceSkuCosts - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkuZoneDetails - from ._models_py3 import ResourceSkusResult -except (SyntaxError, ImportError): - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCapacity # type: ignore - from ._models import ResourceSkuCosts # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceSkusResult # type: ignore +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCapacity +from ._models_py3 import ResourceSkuCosts +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceSkusResult + from ._compute_management_client_enums import ( ResourceSkuCapacityScaleType, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_compute_management_client_enums.py index 7675dc0dd449..d85caa49fe4f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuCapacityScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scale type applicable to the sku. """ @@ -34,14 +19,14 @@ class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, MANUAL = "Manual" NONE = "None" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for restriction. """ QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of restrictions. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models.py deleted file mode 100644 index 07f5f9957229..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models.py +++ /dev/null @@ -1,373 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ResourceSku(msrest.serialization.Model): - """Describes an available Compute 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 name: The name of SKU. - :vartype name: str - :ivar tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` - Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` - **Basic**. - :vartype tier: str - :ivar size: The Size of the SKU. - :vartype size: str - :ivar family: The Family of this particular SKU. - :vartype family: str - :ivar kind: The Kind of resources that are supported in this SKU. - :vartype kind: str - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2019_04_01.models.ResourceSkuCapacity - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: A list of locations and availability zones in those locations where the - SKU is available. - :vartype location_info: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSkuLocationInfo] - :ivar api_versions: The api versions that support this SKU. - :vartype api_versions: list[str] - :ivar costs: Metadata for retrieving price info. - :vartype costs: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSkuCosts] - :ivar capabilities: A name value pair to describe the capability. - :vartype capabilities: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSkuCapabilities] - :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :vartype restrictions: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSkuRestrictions] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'kind': {'readonly': True}, - 'capacity': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'costs': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'ResourceSkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'costs': {'key': 'costs', 'type': '[ResourceSkuCosts]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.location_info = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None - - -class ResourceSkuCapabilities(msrest.serialization.Model): - """Describes The SKU capabilities object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: An invariant to describe the feature. - :vartype name: str - :ivar value: An invariant if the feature is measured by quantity. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapabilities, self).__init__(**kwargs) - self.name = None - self.value = None - - -class ResourceSkuCapacity(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: The default capacity. - :vartype default: long - :ivar scale_type: The scale type applicable to the sku. Possible values include: "Automatic", - "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.compute.v2019_04_01.models.ResourceSkuCapacityScaleType - """ - - _validation = { - 'minimum': {'readonly': True}, - 'maximum': {'readonly': True}, - 'default': {'readonly': True}, - 'scale_type': {'readonly': True}, - } - - _attribute_map = { - 'minimum': {'key': 'minimum', 'type': 'long'}, - 'maximum': {'key': 'maximum', 'type': 'long'}, - 'default': {'key': 'default', 'type': 'long'}, - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapacity, self).__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None - - -class ResourceSkuCosts(msrest.serialization.Model): - """Describes metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The multiplier is needed to extend the base metered cost. - :vartype quantity: long - :ivar extended_unit: An invariant to show the extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterID', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCosts, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """ResourceSkuLocationInfo. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of the SKU. - :vartype location: str - :ivar zones: List of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Details of capabilities available to a SKU in specific zones. - :vartype zone_details: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSkuZoneDetails] - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - 'zone_details': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - self.zone_details = None - - -class ResourceSkuRestrictionInfo(msrest.serialization.Model): - """ResourceSkuRestrictionInfo. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar locations: Locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: List of availability zones where the SKU is restricted. - :vartype zones: list[str] - """ - - _validation = { - 'locations': {'readonly': True}, - 'zones': {'readonly': True}, - } - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = None - self.zones = None - - -class ResourceSkuRestrictions(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 type: The type of restrictions. Possible values include: "Location", "Zone". - :vartype type: str or ~azure.mgmt.compute.v2019_04_01.models.ResourceSkuRestrictionsType - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: The information about the restriction where the SKU cannot be used. - :vartype restriction_info: ~azure.mgmt.compute.v2019_04_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: The reason for restriction. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.compute.v2019_04_01.models.ResourceSkuRestrictionsReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'restriction_info': {'readonly': True}, - 'reason_code': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None - - -class ResourceSkusResult(msrest.serialization.Model): - """The List Resource 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 subscription. - :type value: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSku] - :param next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this - URI to fetch the next page of Resource Skus. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkusResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ResourceSkuZoneDetails(msrest.serialization.Model): - """Describes The zonal capabilities of a SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: A list of capabilities that are available for the SKU in the specified list - of zones. - :vartype capabilities: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSkuCapabilities] - """ - - _validation = { - 'name': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuZoneDetails, self).__init__(**kwargs) - self.name = None - self.capabilities = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py index c8145c51ed35..c02cbe4bb5a4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py @@ -84,6 +84,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -125,6 +127,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = None self.value = None @@ -164,6 +168,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -200,6 +206,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCosts, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -235,6 +243,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -266,6 +276,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -307,6 +319,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = None self.values = None @@ -319,11 +333,11 @@ class ResourceSkusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSku] - :param next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this - URI to fetch the next page of Resource Skus. - :type next_link: str + :ivar value: Required. The list of skus available for the subscription. + :vartype value: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSku] + :ivar next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI + to fetch the next page of Resource Skus. + :vartype next_link: str """ _validation = { @@ -342,6 +356,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the subscription. + :paramtype value: list[~azure.mgmt.compute.v2019_04_01.models.ResourceSku] + :keyword next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this + URI to fetch the next page of Resource Skus. + :paramtype next_link: str + """ super(ResourceSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -373,6 +394,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = None self.capabilities = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py index 3a826c3a2ff0..05f0998149eb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py @@ -5,23 +5,60 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ResourceSkusOperations(object): """ResourceSkusOperations operations. @@ -45,12 +82,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkusResult"] + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceSkusResult"]: """Gets the list of Microsoft.Compute SKUs available for your Subscription. :param filter: The filter to apply on the operation. Only **location** filter is supported @@ -66,36 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-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') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py index 0e1d05ab0365..e3f77bb556ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py @@ -6,86 +6,73 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DiskEncryptionSetsOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import DedicatedHostGroupsOperations -from .operations import DedicatedHostsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMExtensionsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import VirtualMachineRunCommandsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2019_07_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2019_07_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2019_07_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2019_07_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2019_07_01.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2019_07_01.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2019_07_01.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.v2019_07_01.operations.DedicatedHostsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2019_07_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2019_07_01.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2019_07_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2019_07_01.operations.LogAnalyticsOperations :ivar disks: DisksOperations operations @@ -93,117 +80,103 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2019_07_01.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2019_07_01.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2019_07_01.operations.DiskEncryptionSetsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2019_07_01.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2019_07_01.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2019_07_01.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2019_07_01.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2019_07_01.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2019_07_01.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2019_07_01.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2019_07_01.operations.GalleryApplicationVersionsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2019_07_01.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2019_07_01.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py index 6862fe532113..7a15fdda964e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json index 18a98ea30a4f..da2208a2ccfd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py index b521721fdbf4..25cf8cc6d18a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py @@ -6,84 +6,75 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DiskEncryptionSetsOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import Operations -from .operations import AvailabilitySetsOperations -from .operations import ProximityPlacementGroupsOperations -from .operations import DedicatedHostGroupsOperations -from .operations import DedicatedHostsOperations -from .operations import VirtualMachineExtensionImagesOperations -from .operations import VirtualMachineExtensionsOperations -from .operations import VirtualMachineImagesOperations -from .operations import UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -from .operations import VirtualMachineScaleSetExtensionsOperations -from .operations import VirtualMachineScaleSetRollingUpgradesOperations -from .operations import VirtualMachineScaleSetVMExtensionsOperations -from .operations import VirtualMachineScaleSetVMsOperations -from .operations import LogAnalyticsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import VirtualMachineRunCommandsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2019_07_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2019_07_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2019_07_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2019_07_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2019_07_01.aio.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2019_07_01.aio.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2019_07_01.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2019_07_01.aio.operations.DedicatedHostsOperations + :vartype dedicated_hosts: + azure.mgmt.compute.v2019_07_01.aio.operations.DedicatedHostsOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2019_07_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2019_07_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2019_07_01.aio.operations.LogAnalyticsOperations :ivar disks: DisksOperations operations @@ -91,115 +82,103 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2019_07_01.aio.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2019_07_01.aio.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2019_07_01.aio.operations.DiskEncryptionSetsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2019_07_01.aio.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2019_07_01.aio.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2019_07_01.aio.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2019_07_01.aio.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2019_07_01.aio.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2019_07_01.aio.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2019_07_01.aio.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2019_07_01.aio.operations.GalleryApplicationVersionsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2019_07_01.aio.operations.VirtualMachineRunCommandsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.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.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_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_sets = VirtualMachineScaleSetsOperations(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.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations(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.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.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_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_sets = VirtualMachineScaleSetsOperations( - 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.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py index 7ac23952bcb5..56462478dbaf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py index 166a83e34b43..9aa2cefb160b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2019_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2019_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2019_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py index a158bf4ffc55..83bc7650b660 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -254,27 +240,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -288,8 +264,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -301,8 +280,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -310,35 +291,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -356,11 +333,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -369,8 +348,10 @@ def list_by_subscription( 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.v2019_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -378,34 +359,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -423,6 +399,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py index e79ddd4dcf5a..c7f9b17ec345 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -438,7 +417,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -450,30 +430,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -487,8 +456,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -503,8 +475,10 @@ def list_by_host_group( :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.v2019_07_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -512,36 +486,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -559,6 +530,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py index ea036892ed22..26ac67750bc7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,20 @@ async def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore async def _update_initial( @@ -186,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,8 +293,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -329,27 +321,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -363,8 +345,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -376,27 +360,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,6 +383,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -425,15 +401,17 @@ async def begin_delete( :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -447,21 +425,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,8 +444,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +458,10 @@ def list_by_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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -494,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -552,8 +525,10 @@ def list( """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -561,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py index 4aa9c81ea3a0..b6c8d7d39a9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2019_07_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2019_07_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_07_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py index d1ca6cfe8414..5a4326fc80f7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._galleries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'Gallery') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,19 @@ async def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2019_07_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore async def _update_initial( @@ -187,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -226,8 +213,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -246,15 +236,19 @@ async def begin_update( :type gallery: ~azure.mgmt.compute.v2019_07_01.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -266,27 +260,21 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -298,8 +286,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -322,27 +312,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -356,8 +336,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -369,27 +351,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -402,6 +374,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -416,15 +390,17 @@ async def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -438,21 +414,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -464,8 +433,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -477,7 +448,8 @@ def list_by_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 GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -485,35 +457,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -531,11 +499,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -544,7 +514,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -552,34 +523,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -597,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py index 73bc4b21acf5..f3f4c0f6bf43 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_application_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_application_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -133,18 +131,24 @@ async def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +162,21 @@ async def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +188,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +205,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -249,8 +236,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -277,18 +267,24 @@ async def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +298,21 @@ async def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +324,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -372,31 +362,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,8 +389,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -425,29 +406,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -460,6 +431,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -483,15 +456,17 @@ async def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -507,23 +482,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -535,8 +501,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, resource_group_name: str, @@ -555,8 +523,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -564,37 +534,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,6 +580,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py index 3e4516657406..c8de4cdfa608 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -129,15 +127,20 @@ async def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +153,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +179,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore async def _update_initial( @@ -198,33 +195,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -238,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,15 +253,20 @@ async def begin_update( :type gallery_application: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +279,21 @@ async def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,8 +305,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -346,28 +336,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -381,8 +361,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -395,28 +377,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -429,6 +401,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -447,15 +421,17 @@ async def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -470,22 +446,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -497,8 +465,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -513,8 +483,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -522,36 +494,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -569,6 +538,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py index 0bd1225c7f96..006a0727aacd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_image_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_image_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -136,15 +134,20 @@ async def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +161,21 @@ async def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +187,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +204,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -249,8 +235,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -280,15 +269,20 @@ async def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +296,21 @@ async def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +322,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -371,31 +359,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,8 +386,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -424,29 +403,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -459,6 +428,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -481,15 +452,17 @@ async def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -505,23 +478,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -533,8 +497,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, resource_group_name: str, @@ -553,8 +519,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -562,37 +530,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py index 32e069a63557..203708944a16 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -128,15 +126,19 @@ async def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +151,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -182,6 +177,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore async def _update_initial( @@ -197,33 +193,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -237,8 +223,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -262,15 +251,19 @@ async def begin_update( :type gallery_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +276,21 @@ async def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,8 +302,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -344,28 +332,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -379,8 +357,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -393,28 +373,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -427,6 +397,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -445,15 +417,17 @@ async def begin_delete( :type gallery_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -468,22 +442,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -512,7 +480,8 @@ def list_by_gallery( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] @@ -520,36 +489,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -567,6 +533,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py index cf958d4598f3..a05e9c52711a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2019_07_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2019_07_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py index 31c9fd726a73..2a01cddda517 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py index dba6b6c8ebb9..7ad634a82108 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2019_07_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py index d2bc6eb098f3..334fcd9a676e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -256,29 +242,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +267,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,8 +279,10 @@ def list_by_subscription( """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.v2019_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -310,34 +290,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,11 +330,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -370,8 +347,10 @@ def list_by_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.v2019_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -379,35 +358,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,6 +400,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py index bbd9a6bc8aa1..b4d63663ffb8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2019_07_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2019_07_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_07_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py index 9d7cf9db9ee6..ba867180db3d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2019_07_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py index 49efab2d031d..c8799853a203 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py index c3a8fcc9da1e..5c99dc62ebb0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2019_07_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_images_operations.py index de71204e3d57..2d4b36037e02 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py index 94f11c60156c..e5a976153d3f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2019_07_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 4c2af73b58fe..fd0ace2c5d45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -193,33 +191,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,18 +248,24 @@ async def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,28 +278,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -314,6 +304,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -328,26 +319,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +362,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +387,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,8 +406,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -457,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -494,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -509,8 +482,10 @@ def list( :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.v2019_07_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -518,36 +493,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -565,6 +537,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 33f123b601df..e83c740f9f46 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index da6f2b5e4a46..6e778fc9b85e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +124,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +151,21 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +177,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +194,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +225,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,18 +251,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,29 +282,21 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -322,6 +308,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -337,29 +324,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -372,6 +349,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +371,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,23 +397,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,8 +416,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -477,31 +451,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -515,8 +478,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -545,30 +511,19 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -582,4 +537,6 @@ async def list( 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/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 1ff097874863..8d5f3ae0132d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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.v2019_07_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -546,26 +513,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -578,6 +537,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -595,15 +556,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -618,22 +581,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -645,8 +600,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -663,7 +620,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -675,30 +633,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -712,8 +659,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -739,28 +689,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -774,8 +714,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -801,8 +744,10 @@ def list( '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.v2019_07_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -810,42 +755,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -863,6 +805,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -881,28 +824,19 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -915,6 +849,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -939,15 +875,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -963,22 +901,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -990,6 +920,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1004,26 +935,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1036,6 +959,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1053,15 +978,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1076,22 +1003,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1103,6 +1022,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1117,26 +1037,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1149,6 +1061,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1166,15 +1080,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1189,22 +1105,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1216,6 +1124,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1230,26 +1139,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1262,6 +1163,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1280,15 +1183,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1303,22 +1208,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1330,6 +1227,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1344,26 +1242,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1376,6 +1266,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1394,15 +1286,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1417,22 +1311,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1444,6 +1330,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1459,33 +1346,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1501,8 +1378,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1523,15 +1403,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1544,28 +1429,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1577,4 +1455,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py index 9066f1433d9a..79a39d142b9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -337,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -351,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -399,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -423,27 +405,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -457,8 +429,10 @@ async def get( 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, @@ -471,33 +445,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,6 +476,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -526,18 +494,22 @@ async def begin_deallocate( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,24 +521,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -578,6 +544,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -592,30 +559,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -628,6 +587,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -642,18 +603,22 @@ async def begin_delete_instances( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -665,24 +630,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -694,8 +653,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -718,27 +679,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -752,8 +703,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -764,8 +718,10 @@ def list( :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.v2019_07_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -773,35 +729,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -819,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -833,8 +787,10 @@ def list_all( 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.v2019_07_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -842,34 +798,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -887,11 +838,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -906,8 +859,10 @@ def list_skus( :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.v2019_07_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -915,36 +870,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -962,11 +914,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -980,8 +934,10 @@ def get_os_upgrade_history( :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.v2019_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -989,36 +945,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1036,6 +989,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1054,35 +1008,26 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1095,6 +1040,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1116,18 +1063,22 @@ async def begin_power_off( 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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1140,24 +1091,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1169,6 +1114,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1183,33 +1129,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1222,6 +1160,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1236,18 +1176,22 @@ async def begin_restart( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1259,24 +1203,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1288,6 +1226,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1302,33 +1241,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1341,6 +1272,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1355,18 +1288,22 @@ async def begin_start( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1378,24 +1315,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1407,6 +1338,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1421,33 +1353,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1460,6 +1384,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1475,18 +1401,22 @@ async def begin_redeploy( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1498,24 +1428,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1527,6 +1451,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1541,33 +1466,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1580,6 +1497,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1597,18 +1516,22 @@ async def begin_perform_maintenance( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1620,24 +1543,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1649,6 +1566,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1663,30 +1581,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1699,6 +1609,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1713,18 +1625,22 @@ async def begin_update_instances( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,24 +1652,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1765,6 +1675,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1779,33 +1690,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1818,6 +1721,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1834,18 +1739,22 @@ async def begin_reimage( :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.v2019_07_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1857,24 +1766,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1886,6 +1789,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1900,33 +1804,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1939,6 +1835,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1954,18 +1852,22 @@ async def begin_reimage_all( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1977,24 +1879,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2006,8 +1902,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2035,28 +1933,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2070,8 +1958,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2086,7 +1977,8 @@ async def convert_to_single_placement_group( :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.v2019_07_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2019_07_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 @@ -2097,30 +1989,22 @@ async def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2132,3 +2016,4 @@ async def convert_to_single_placement_group( return cls(pipeline_response, None, {}) convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py index ae9c7f215e6b..0b43645dbda9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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.v2019_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py index 5859fbdf05c5..72a4610229eb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_reapply_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2019_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -315,15 +306,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -367,6 +357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +372,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +405,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -443,15 +427,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,27 +452,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,6 +478,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -508,25 +492,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -539,6 +515,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -553,15 +531,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -575,21 +555,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -601,8 +574,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -616,7 +591,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -628,29 +604,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -664,8 +629,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -688,27 +656,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -722,8 +680,10 @@ async def instance_view( 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, @@ -735,25 +695,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -766,6 +718,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -785,15 +739,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -807,21 +763,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -833,6 +782,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -846,25 +796,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -877,6 +819,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -892,15 +836,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -914,21 +860,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -940,8 +879,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -969,25 +910,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1000,6 +933,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1011,8 +946,10 @@ def list( :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.v2019_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1020,35 +957,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1066,11 +999,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1083,8 +1018,10 @@ def list_all( 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.v2019_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1092,36 +1029,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1139,11 +1071,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1158,8 +1092,10 @@ def list_available_sizes( :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.v2019_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1167,36 +1103,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1214,6 +1147,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1231,27 +1165,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1264,6 +1189,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1284,15 +1211,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,21 +1236,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1333,6 +1255,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1346,27 +1269,17 @@ async def _reapply_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1379,6 +1292,8 @@ async def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace_async async def begin_reapply( self, resource_group_name: str, @@ -1393,15 +1308,17 @@ async def begin_reapply( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1415,21 +1332,14 @@ async def begin_reapply( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1441,6 +1351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1454,25 +1365,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1485,6 +1388,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1499,15 +1404,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1521,21 +1428,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1547,6 +1447,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1560,25 +1461,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1591,6 +1484,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1605,15 +1500,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1627,21 +1524,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1653,6 +1543,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1666,25 +1557,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1697,6 +1580,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1711,15 +1596,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1733,21 +1620,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1759,6 +1639,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1773,33 +1654,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1812,6 +1685,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1829,15 +1704,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1849,24 +1727,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1878,6 +1750,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1891,25 +1764,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1922,6 +1787,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1937,15 +1804,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1959,21 +1828,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1985,6 +1847,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -1999,32 +1862,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2040,8 +1893,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -2059,15 +1915,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2079,27 +1940,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2111,4 +1966,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_07_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/__init__.py index 17aabb899970..9cfeac2f5f6b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/__init__.py @@ -6,466 +6,236 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - 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 BillingProfile - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import CreationData - 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 DedicatedHostGroupListResult - from ._models_py3 import DedicatedHostGroupUpdate - from ._models_py3 import DedicatedHostInstanceView - from ._models_py3 import DedicatedHostListResult - from ._models_py3 import DedicatedHostUpdate - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiffDiskSettings - from ._models_py3 import Disallowed - from ._models_py3 import Disk - from ._models_py3 import DiskEncryptionSet - from ._models_py3 import DiskEncryptionSetList - from ._models_py3 import DiskEncryptionSetParameters - from ._models_py3 import DiskEncryptionSetUpdate - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import Encryption - from ._models_py3 import EncryptionSetIdentity - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import Gallery - from ._models_py3 import GalleryApplication - from ._models_py3 import GalleryApplicationList - from ._models_py3 import GalleryApplicationUpdate - from ._models_py3 import GalleryApplicationVersion - from ._models_py3 import GalleryApplicationVersionList - from ._models_py3 import GalleryApplicationVersionPublishingProfile - from ._models_py3 import GalleryApplicationVersionUpdate - from ._models_py3 import GalleryArtifactPublishingProfileBase - from ._models_py3 import GalleryArtifactSource - from ._models_py3 import GalleryArtifactVersionSource - from ._models_py3 import GalleryDataDiskImage - from ._models_py3 import GalleryDiskImage - from ._models_py3 import GalleryIdentifier - from ._models_py3 import GalleryImage - from ._models_py3 import GalleryImageIdentifier - from ._models_py3 import GalleryImageList - from ._models_py3 import GalleryImageUpdate - from ._models_py3 import GalleryImageVersion - from ._models_py3 import GalleryImageVersionList - from ._models_py3 import GalleryImageVersionPublishingProfile - from ._models_py3 import GalleryImageVersionStorageProfile - from ._models_py3 import GalleryImageVersionUpdate - from ._models_py3 import GalleryList - from ._models_py3 import GalleryOSDiskImage - from ._models_py3 import GalleryUpdate - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDisk - from ._models_py3 import ImageDiskReference - from ._models_py3 import ImageListResult - from ._models_py3 import ImageOSDisk - from ._models_py3 import ImagePurchasePlan - from ._models_py3 import ImageReference - from ._models_py3 import ImageStorageProfile - from ._models_py3 import ImageUpdate - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - from ._models_py3 import LogAnalyticsInputBase - from ._models_py3 import LogAnalyticsOperationResult - from ._models_py3 import LogAnalyticsOutput - from ._models_py3 import MaintenanceRedeployStatus - from ._models_py3 import ManagedArtifact - 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 OSProfile - 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 RecommendedMachineConfiguration - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RegionalReplicationStatus - from ._models_py3 import ReplicationStatus - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - from ._models_py3 import ResourceRange - 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 Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import SshConfiguration - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import SubResourceWithColocationStatus - from ._models_py3 import TargetRegion - from ._models_py3 import TerminateNotificationProfile - from ._models_py3 import ThrottledRequestsInput - 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 UserArtifactManage - from ._models_py3 import UserArtifactSource - 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineReimageParameters - 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 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 VirtualMachineStatusCodeCount - from ._models_py3 import VirtualMachineUpdate - from ._models_py3 import WinRMConfiguration - from ._models_py3 import WinRMListener - from ._models_py3 import WindowsConfiguration -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - 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 BillingProfile # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # type: ignore - from ._models import ComputeOperationListResult # type: ignore - from ._models import ComputeOperationValue # type: ignore - from ._models import CreationData # 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 DedicatedHostGroupListResult # type: ignore - from ._models import DedicatedHostGroupUpdate # type: ignore - from ._models import DedicatedHostInstanceView # 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 Disallowed # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskEncryptionSet # type: ignore - from ._models import DiskEncryptionSetList # type: ignore - from ._models import DiskEncryptionSetParameters # type: ignore - from ._models import DiskEncryptionSetUpdate # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionSetIdentity # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import Gallery # type: ignore - from ._models import GalleryApplication # type: ignore - from ._models import GalleryApplicationList # type: ignore - from ._models import GalleryApplicationUpdate # type: ignore - from ._models import GalleryApplicationVersion # type: ignore - from ._models import GalleryApplicationVersionList # type: ignore - from ._models import GalleryApplicationVersionPublishingProfile # type: ignore - from ._models import GalleryApplicationVersionUpdate # type: ignore - from ._models import GalleryArtifactPublishingProfileBase # type: ignore - from ._models import GalleryArtifactSource # type: ignore - from ._models import GalleryArtifactVersionSource # type: ignore - from ._models import GalleryDataDiskImage # type: ignore - from ._models import GalleryDiskImage # type: ignore - from ._models import GalleryIdentifier # type: ignore - from ._models import GalleryImage # type: ignore - from ._models import GalleryImageIdentifier # type: ignore - from ._models import GalleryImageList # type: ignore - from ._models import GalleryImageUpdate # type: ignore - from ._models import GalleryImageVersion # type: ignore - from ._models import GalleryImageVersionList # type: ignore - from ._models import GalleryImageVersionPublishingProfile # type: ignore - from ._models import GalleryImageVersionStorageProfile # type: ignore - from ._models import GalleryImageVersionUpdate # type: ignore - from ._models import GalleryList # type: ignore - from ._models import GalleryOSDiskImage # type: ignore - from ._models import GalleryUpdate # type: ignore - from ._models import GrantAccessData # 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 ImageDiskReference # type: ignore - from ._models import ImageListResult # type: ignore - from ._models import ImageOSDisk # type: ignore - from ._models import ImagePurchasePlan # 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 InstanceViewStatus # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 ManagedArtifact # 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 OSProfile # 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 RecommendedMachineConfiguration # type: ignore - from ._models import RecoveryWalkResponse # type: ignore - from ._models import RegionalReplicationStatus # type: ignore - from ._models import ReplicationStatus # type: ignore - from ._models import RequestRateByIntervalInput # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRange # 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 Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import SshConfiguration # type: ignore - from ._models import SshPublicKey # 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 TargetRegion # type: ignore - from ._models import TerminateNotificationProfile # type: ignore - from ._models import ThrottledRequestsInput # 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 UserArtifactManage # type: ignore - from ._models import UserArtifactSource # 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineReimageParameters # 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 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 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_py3 import AccessUri +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 BillingProfile +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import CreationData +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 DedicatedHostGroupListResult +from ._models_py3 import DedicatedHostGroupUpdate +from ._models_py3 import DedicatedHostInstanceView +from ._models_py3 import DedicatedHostListResult +from ._models_py3 import DedicatedHostUpdate +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiffDiskSettings +from ._models_py3 import Disallowed +from ._models_py3 import Disk +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetParameters +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import Gallery +from ._models_py3 import GalleryApplication +from ._models_py3 import GalleryApplicationList +from ._models_py3 import GalleryApplicationUpdate +from ._models_py3 import GalleryApplicationVersion +from ._models_py3 import GalleryApplicationVersionList +from ._models_py3 import GalleryApplicationVersionPublishingProfile +from ._models_py3 import GalleryApplicationVersionUpdate +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryArtifactVersionSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryIdentifier +from ._models_py3 import GalleryImage +from ._models_py3 import GalleryImageIdentifier +from ._models_py3 import GalleryImageList +from ._models_py3 import GalleryImageUpdate +from ._models_py3 import GalleryImageVersion +from ._models_py3 import GalleryImageVersionList +from ._models_py3 import GalleryImageVersionPublishingProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryImageVersionUpdate +from ._models_py3 import GalleryList +from ._models_py3 import GalleryOSDiskImage +from ._models_py3 import GalleryUpdate +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDisk +from ._models_py3 import ImageDiskReference +from ._models_py3 import ImageListResult +from ._models_py3 import ImageOSDisk +from ._models_py3 import ImagePurchasePlan +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import ImageUpdate +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +from ._models_py3 import LogAnalyticsInputBase +from ._models_py3 import LogAnalyticsOperationResult +from ._models_py3 import LogAnalyticsOutput +from ._models_py3 import MaintenanceRedeployStatus +from ._models_py3 import ManagedArtifact +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 OSProfile +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 RecommendedMachineConfiguration +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RegionalReplicationStatus +from ._models_py3 import ReplicationStatus +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceRange +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 Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import SubResourceWithColocationStatus +from ._models_py3 import TargetRegion +from ._models_py3 import TerminateNotificationProfile +from ._models_py3 import ThrottledRequestsInput +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 UserArtifactManage +from ._models_py3 import UserArtifactSource +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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineReimageParameters +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 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 VirtualMachineStatusCodeCount +from ._models_py3 import VirtualMachineUpdate +from ._models_py3 import WinRMConfiguration +from ._models_py3 import WinRMListener +from ._models_py3 import WindowsConfiguration + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py index 74e3b3efb358..bd9627e561c1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the aggregated replication status based on all the regional replication status flags. """ @@ -41,7 +26,7 @@ class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, E COMPLETED = "Completed" FAILED = "Failed" -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -49,7 +34,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -60,7 +45,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -71,13 +56,13 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiffDiskOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the ephemeral disk option for operating system disk. """ LOCAL = "Local" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -99,7 +84,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the disk. UPLOAD = "Upload" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -112,13 +97,13 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. """ SYSTEM_ASSIGNED = "SystemAssigned" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the disk. """ @@ -135,7 +120,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -150,7 +135,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: databases (for example, SQL, Oracle), and other transaction-heavy workloads. ULTRA_SSD_LRS = "UltraSSD_LRS" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -159,7 +144,7 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Disk is encrypted with Customer managed key at rest. ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY = "EncryptionAtRestWithCustomerKey" -class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -170,7 +155,7 @@ class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseI DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImagePropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -181,7 +166,7 @@ class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImageVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -192,7 +177,7 @@ class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensi DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -203,7 +188,7 @@ class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta DELETING = "Deleting" MIGRATING = "Migrating" -class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' """ @@ -211,28 +196,28 @@ class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -241,7 +226,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -250,7 +235,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -259,7 +244,7 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -268,14 +253,14 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -283,7 +268,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -292,7 +277,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the regional replication state. """ @@ -301,11 +286,11 @@ class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAILED = "Failed" -class ReplicationStatusTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationStatusTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REPLICATION_STATUS = "ReplicationStatus" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -316,14 +301,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -332,7 +317,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -340,7 +325,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -351,7 +336,7 @@ class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Standard zone redundant storage. STANDARD_ZRS = "Standard_ZRS" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -359,7 +344,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type to be used to store the image. This property is not updatable. """ @@ -367,7 +352,7 @@ class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_LRS = "Standard_LRS" STANDARD_ZRS = "Standard_ZRS" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. @@ -382,7 +367,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -394,7 +379,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -402,7 +387,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -411,14 +396,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -428,20 +413,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models.py deleted file mode 100644 index a4b45e60be4c..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models.py +++ /dev/null @@ -1,9412 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2019_07_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_07_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_07_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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.v2019_07_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.v2019_07_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.v2019_07_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2019_07_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2019_07_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, - **kwargs - ): - 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 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, - **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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux serial console log blob Uri. - :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.v2019_07_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 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.v2019_07_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 CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', 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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.DedicatedHostInstanceView - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'platform_fault_domain': {'maximum': 2, '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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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.v2019_07_01.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, - } - - def __init__( - self, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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.v2019_07_01.models.SubResourceReadOnly] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'platform_fault_domain_count': {'maximum': 3, 'minimum': 1}, - 'hosts': {'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]'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2019_07_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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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.v2019_07_01.models.SubResourceReadOnly] - """ - - _validation = { - 'platform_fault_domain_count': {'maximum': 3, 'minimum': 1}, - 'hosts': {'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]'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2019_07_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', 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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.DedicatedHostInstanceView - """ - - _validation = { - 'platform_fault_domain': {'maximum': 2, '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.v2019_07_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.v2019_07_01.models.DiffDiskOptions - """ - - _attribute_map = { - 'option': {'key': 'option', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiffDiskSettings, self).__init__(**kwargs) - self.option = kwargs.get('option', None) - - -class Disallowed(msrest.serialization.Model): - """Describes the disallowed disk types. - - :param disk_types: A list of disk types. - :type disk_types: list[str] - """ - - _attribute_map = { - 'disk_types': {'key': 'diskTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Disallowed, self).__init__(**kwargs) - self.disk_types = kwargs.get('disk_types', None) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: int - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2019_07_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_state = None - self.encryption = kwargs.get('encryption', None) - - -class DiskEncryptionSet(Resource): - """disk encryption set resource. - - 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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSetIdentity - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'previous_keys': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyVaultAndKeyReference]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSet, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.active_key = kwargs.get('active_key', None) - self.previous_keys = None - self.provisioning_state = None - - -class DiskEncryptionSetList(msrest.serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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.v2019_07_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.v2019_07_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 DiskEncryptionSetUpdate(msrest.serialization.Model): - """disk encryption set update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is - used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.active_key = kwargs.get('active_key', 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.v2019_07_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_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 DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2019_07_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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) - self.encryption = kwargs.get('encryption', None) - - -class Encryption(msrest.serialization.Model): - """Encryption at rest settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :type disk_encryption_set_id: str - :param type: Required. The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey". - :type type: str or ~azure.mgmt.compute.v2019_07_01.models.EncryptionType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.type = kwargs['type'] - - -class EncryptionSetIdentity(msrest.serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSetIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class Gallery(Resource): - """Specifies information about the Shared Image Gallery that you want to create or update. - - 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 description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryPropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Gallery, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - - -class GalleryApplication(Resource): - """Specifies information about the gallery Application Definition that you want to create or update. - - 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 description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplication, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationList(msrest.serialization.Model): - """The List Gallery Applications operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application - Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryApplicationUpdate(UpdateResource): - """Specifies information about the gallery Application Definition that you want to update. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationVersion(Resource): - """Specifies information about the gallery Application Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_07_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryApplicationVersionList(msrest.serialization.Model): - """The List Gallery Application version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call - ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplicationVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): - """Describes the basic gallery artifact publishing profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) - self.target_regions = kwargs.get('target_regions', None) - self.replica_count = kwargs.get('replica_count', None) - self.exclude_from_latest = kwargs.get('exclude_from_latest', None) - self.published_date = None - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - - -class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image version. - - 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 target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool - """ - - _validation = { - 'published_date': {'readonly': True}, - 'source': {'required': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, - 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) - self.source = kwargs['source'] - self.manage_actions = kwargs.get('manage_actions', None) - self.enable_health_check = kwargs.get('enable_health_check', None) - - -class GalleryApplicationVersionUpdate(UpdateResource): - """Specifies information about the gallery Application Version that you want to update. - - 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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_07_01.models.ReplicationStatus - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2019_07_01.models.ManagedArtifact - """ - - _validation = { - 'managed_image': {'required': True}, - } - - _attribute_map = { - 'managed_image': {'key': 'managedImage', 'type': 'ManagedArtifact'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactSource, self).__init__(**kwargs) - self.managed_image = kwargs['managed_image'] - - -class GalleryArtifactVersionSource(msrest.serialization.Model): - """The gallery artifact version source. - - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, - or user image. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactVersionSource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class GalleryDiskImage(msrest.serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDiskImage, self).__init__(**kwargs) - self.size_in_gb = None - self.host_caching = kwargs.get('host_caching', None) - self.source = kwargs.get('source', None) - - -class GalleryDataDiskImage(GalleryDiskImage): - """This is the data disk 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 size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This - value is used to identify data disks within the Virtual Machine and therefore must be unique - for each data disk attached to the Virtual Machine. - :type lun: int - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'lun': {'required': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDataDiskImage, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -class GalleryIdentifier(msrest.serialization.Model): - """Describes the gallery unique name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated - automatically by Azure. - :vartype unique_name: str - """ - - _validation = { - 'unique_name': {'readonly': True}, - } - - _attribute_map = { - 'unique_name': {'key': 'uniqueName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryIdentifier, self).__init__(**kwargs) - self.unique_name = None - - -class GalleryImage(Resource): - """Specifies information about the gallery Image Definition that you want to create or update. - - 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 description: The description of this gallery Image Definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2019_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryImagePropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImage, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageIdentifier(msrest.serialization.Model): - """This is the gallery Image Definition identifier. - - All required parameters must be populated in order to send to Azure. - - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str - """ - - _validation = { - 'publisher': {'required': True}, - 'offer': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageIdentifier, self).__init__(**kwargs) - self.publisher = kwargs['publisher'] - self.offer = kwargs['offer'] - self.sku = kwargs['sku'] - - -class GalleryImageList(msrest.serialization.Model): - """The List Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageUpdate(UpdateResource): - """Specifies information about the gallery Image Definition that you want to update. - - 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 description: The description of this gallery Image Definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2019_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryImagePropertiesProvisioningState - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageVersion(Resource): - """Specifies information about the gallery Image Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_07_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryImageVersionList(msrest.serialization.Model): - """The List Gallery Image version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionPublishingProfile, self).__init__(**kwargs) - - -class GalleryImageVersionStorageProfile(msrest.serialization.Model): - """This is the storage profile of a Gallery Image Version. - - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.GalleryDataDiskImage] - """ - - _attribute_map = { - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'os_disk_image': {'key': 'osDiskImage', 'type': 'GalleryOSDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[GalleryDataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', None) - - -class GalleryImageVersionUpdate(UpdateResource): - """Specifies information about the gallery Image Version that you want to update. - - 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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_07_01.models.ReplicationStatus - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryList(msrest.serialization.Model): - """The List Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Gallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryOSDiskImage, self).__init__(**kwargs) - - -class GalleryUpdate(UpdateResource): - """Specifies information about the Shared Image Gallery that you want to update. - - 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 description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_07_01.models.GalleryPropertiesProvisioningState - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2019_07_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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.v2019_07_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_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}'}, - '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.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.v2019_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_07_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.v2019_07_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_07_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.v2019_07_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_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.v2019_07_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 ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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.v2019_07_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.v2019_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_07_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.v2019_07_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_07_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 ImagePurchasePlan(msrest.serialization.Model): - """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImagePurchasePlan, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.publisher = kwargs.get('publisher', None) - self.product = kwargs.get('product', None) - - -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.v2019_07_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.v2019_07_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.v2019_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_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 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.v2019_07_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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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.v2019_07_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.v2019_07_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 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.v2019_07_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 - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, - } - - 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) - - -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.v2019_07_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 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 - """ - - _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'}, - } - - 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) - - -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.v2019_07_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.v2019_07_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 ManagedArtifact(msrest.serialization.Model): - """The managed artifact. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The managed artifact id. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedArtifact, self).__init__(**kwargs) - self.id = kwargs['id'] - - -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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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 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.v2019_07_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.v2019_07_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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 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.v2019_07_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.v2019_07_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2019_07_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. - :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 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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2019_07_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.v2019_07_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 RecommendedMachineConfiguration(msrest.serialization.Model): - """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange - """ - - _attribute_map = { - 'v_cp_us': {'key': 'vCPUs', 'type': 'ResourceRange'}, - 'memory': {'key': 'memory', 'type': 'ResourceRange'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedMachineConfiguration, self).__init__(**kwargs) - self.v_cp_us = kwargs.get('v_cp_us', None) - self.memory = kwargs.get('memory', None) - - -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 RegionalReplicationStatus(msrest.serialization.Model): - """This is the regional replication status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: The region to which the gallery Image Version is being replicated to. - :vartype region: str - :ivar state: This is the regional replication state. Possible values include: "Unknown", - "Replicating", "Completed", "Failed". - :vartype state: str or ~azure.mgmt.compute.v2019_07_01.models.ReplicationState - :ivar details: The details of the replication status. - :vartype details: str - :ivar progress: It indicates progress of the replication job. - :vartype progress: int - """ - - _validation = { - 'region': {'readonly': True}, - 'state': {'readonly': True}, - 'details': {'readonly': True}, - 'progress': {'readonly': True}, - } - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalReplicationStatus, self).__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None - - -class ReplicationStatus(msrest.serialization.Model): - """This is the replication status of the gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: This is the aggregated replication status based on all the regional - replication status flags. Possible values include: "Unknown", "InProgress", "Completed", - "Failed". - :vartype aggregated_state: str or - ~azure.mgmt.compute.v2019_07_01.models.AggregatedReplicationState - :ivar summary: This is a summary of replication status for each region. - :vartype summary: list[~azure.mgmt.compute.v2019_07_01.models.RegionalReplicationStatus] - """ - - _validation = { - 'aggregated_state': {'readonly': True}, - 'summary': {'readonly': True}, - } - - _attribute_map = { - 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': '[RegionalReplicationStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationStatus, self).__init__(**kwargs) - self.aggregated_state = None - self.summary = 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 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.v2019_07_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'}, - 'interval_length': {'key': 'intervalLength', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RequestRateByIntervalInput, self).__init__(**kwargs) - self.interval_length = kwargs['interval_length'] - - -class ResourceRange(msrest.serialization.Model): - """Describes the resource range. - - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int - """ - - _attribute_map = { - 'min': {'key': 'min', 'type': 'int'}, - 'max': {'key': 'max', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRange, self).__init__(**kwargs) - self.min = kwargs.get('min', None) - self.max = kwargs.get('max', 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.v2019_07_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 - """ - - _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'}, - } - - 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) - - -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.v2019_07_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.v2019_07_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.v2019_07_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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 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 Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - self.encryption = kwargs.get('encryption', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2019_07_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.encryption = kwargs.get('encryption', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', 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.v2019_07_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 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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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 TargetRegion(msrest.serialization.Model): - """Describes the target region information. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'regional_replica_count': {'key': 'regionalReplicaCount', 'type': 'int'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetRegion, self).__init__(**kwargs) - self.name = kwargs['name'] - self.regional_replica_count = kwargs.get('regional_replica_count', None) - self.storage_account_type = kwargs.get('storage_account_type', 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ThrottledRequestsInput, self).__init__(**kwargs) - - -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.v2019_07_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.v2019_07_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type automatic_os_upgrade_policy: - ~azure.mgmt.compute.v2019_07_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: An enum describing the unit of usage measurement. Has constant 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.v2019_07_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 UserArtifactManage(msrest.serialization.Model): - """UserArtifactManage. - - All required parameters must be populated in order to send to Azure. - - :param install: Required. Required. The path and arguments to install the gallery application. - This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. - This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not - present, then update operation will invoke remove command on the previous version and install - command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str - """ - - _validation = { - 'install': {'required': True}, - 'remove': {'required': True}, - } - - _attribute_map = { - 'install': {'key': 'install', 'type': 'str'}, - 'remove': {'key': 'remove', 'type': 'str'}, - 'update': {'key': 'update', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactManage, self).__init__(**kwargs) - self.install = kwargs['install'] - self.remove = kwargs['remove'] - self.update = kwargs.get('update', None) - - -class UserArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must - be a readable storage page blob. - :type default_configuration_link: str - """ - - _validation = { - 'media_link': {'required': True}, - } - - _attribute_map = { - 'media_link': {'key': 'mediaLink', 'type': 'str'}, - 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactSource, self).__init__(**kwargs) - self.media_link = kwargs['media_link'] - self.default_configuration_link = kwargs.get('default_configuration_link', 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.v2019_07_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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, the only - supported value is 'Deallocate' 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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - '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'}, - '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'}, - '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'}, - } - - 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.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.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.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2019_07_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_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 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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2019_07_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'}, - '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.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.v2019_07_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.v2019_07_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_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.v2019_07_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2019_07_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.v2019_07_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.v2019_07_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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2019_07_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: - ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.HyperVGenerationTypes - """ - - _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}'}, - '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'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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.v2019_07_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.v2019_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2019_07_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView] - :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.v2019_07_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] - """ - - _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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2019_07_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 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 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.v2019_07_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.v2019_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2019_07_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. - :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.v2019_07_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.v2019_07_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.v2019_07_01.models.ScaleInPolicy - """ - - _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]'}, - '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'}, - 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, - 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, - } - - 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.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.additional_capabilities = kwargs.get('additional_capabilities', None) - self.scale_in_policy = kwargs.get('scale_in_policy', 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.v2019_07_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.v2019_07_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.v2019_07_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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'}, - '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.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.v2019_07_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.v2019_07_01.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('extensions', 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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'}, - '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.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.v2019_07_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.v2019_07_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.v2019_07_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] - """ - - _validation = { - 'virtual_machine': {'readonly': True}, - 'extensions': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) - self.virtual_machine = None - self.extensions = None - self.statuses = kwargs.get('statuses', 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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_07_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 load balancer. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2019_07_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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. 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. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_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.v2019_07_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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2019_07_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'}, - '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.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.v2019_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2019_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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. - - :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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2019_07_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'}, - '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.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.v2019_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - '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'}, - } - - 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.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) - - -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.v2019_07_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.v2019_07_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: - ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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.v2019_07_01.models.VirtualMachineScaleSetVMProtectionPolicy - """ - - _validation = { - '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 = { - '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'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.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) - - -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.v2019_07_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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2019_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2019_07_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2019_07_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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.v2019_07_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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.v2019_07_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, the only - supported value is 'Deallocate' 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.v2019_07_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.v2019_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - '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'}, - } - - 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.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) - - -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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2019_07_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_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, the only - supported value is 'Deallocate' 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.v2019_07_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.v2019_07_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.v2019_07_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.v2019_07_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - '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'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.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.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': '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.v2019_07_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2019_07_01.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2019_07_01.models.WinRMListener] - """ - - _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.v2019_07_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2019_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py index f58b276eb4fe..cc082c60f8d9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,11 +44,11 @@ def __init__( 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -59,6 +61,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -66,21 +75,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2019_07_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2019_07_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -99,6 +108,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2019_07_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -109,9 +135,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -124,6 +150,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -131,16 +162,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_07_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_07_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2019_07_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2019_07_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -161,6 +192,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2019_07_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2019_07_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -172,12 +215,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -194,6 +237,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -203,16 +254,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -227,6 +278,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -237,9 +300,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -256,6 +319,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -263,15 +331,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -286,6 +354,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -304,10 +383,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -332,6 +411,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -353,25 +438,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_07_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.v2019_07_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: + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :ivar 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.v2019_07_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ @@ -410,6 +495,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -424,11 +531,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -447,6 +554,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -455,8 +569,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -469,6 +583,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -478,20 +596,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2019_07_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.v2019_07_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :ivar 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.v2019_07_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ @@ -521,6 +639,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -533,7 +668,7 @@ def __init__( 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. + :ivar 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 @@ -545,7 +680,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -558,6 +693,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -565,11 +715,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -584,6 +734,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -619,6 +776,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -646,6 +805,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -691,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -707,27 +870,27 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager + :vartype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long + :vartype upload_size_bytes: long """ _validation = { @@ -756,6 +919,26 @@ def __init__( upload_size_bytes: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -773,44 +956,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2019_07_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :ivar 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.v2019_07_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :ivar 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.v2019_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_07_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :ivar 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.v2019_07_01.models.ManagedDiskParameters - :param to_be_detached: Specifies whether the data disk is in process of detachment from the + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype 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. @@ -858,6 +1041,46 @@ def __init__( to_be_detached: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -895,6 +1118,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -912,29 +1137,29 @@ class DedicatedHost(Resource): :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.v2019_07_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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2019_07_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2019_07_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2019_07_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. @@ -985,6 +1210,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2019_07_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -1000,11 +1247,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -1019,6 +1266,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -1027,9 +1281,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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.v2019_07_01.models.DedicatedHostAllocatableVM] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1042,6 +1297,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1059,16 +1320,16 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2019_07_01.models.SubResourceReadOnly] """ @@ -1102,6 +1363,18 @@ def __init__( platform_fault_domain_count: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1113,11 +1386,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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.v2019_07_01.models.DedicatedHostGroup] - :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1136,6 +1409,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1146,14 +1426,14 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2019_07_01.models.SubResourceReadOnly] """ @@ -1178,6 +1458,16 @@ def __init__( platform_fault_domain_count: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1192,10 +1482,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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.v2019_07_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2019_07_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ _validation = { @@ -1215,6 +1506,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2019_07_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -1226,11 +1524,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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.v2019_07_01.models.DedicatedHost] - :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1249,6 +1547,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1259,24 +1564,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2019_07_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2019_07_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2019_07_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. @@ -1315,6 +1620,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2019_07_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -1329,11 +1651,11 @@ def __init__( 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 + :ivar 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.v2019_07_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_07_01.models.BootDiagnostics """ _attribute_map = { @@ -1346,6 +1668,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_07_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -1353,9 +1682,9 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2019_07_01.models.DiffDiskOptions + :vartype option: str or ~azure.mgmt.compute.v2019_07_01.models.DiffDiskOptions """ _attribute_map = { @@ -1368,6 +1697,11 @@ def __init__( option: Optional[Union[str, "DiffDiskOptions"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2019_07_01.models.DiffDiskOptions + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option @@ -1375,8 +1709,8 @@ def __init__( class Disallowed(msrest.serialization.Model): """Describes the disallowed disk types. - :param disk_types: A list of disk types. - :type disk_types: list[str] + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] """ _attribute_map = { @@ -1389,6 +1723,10 @@ def __init__( disk_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ super(Disallowed, self).__init__(**kwargs) self.disk_types = disk_types @@ -1406,55 +1744,55 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: int + :vartype disk_m_bps_read_write: int :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2019_07_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption """ _validation = { @@ -1511,6 +1849,44 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -1543,15 +1919,15 @@ class DiskEncryptionSet(Resource): :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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSetIdentity - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSetIdentity + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference :ivar previous_keys: A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. @@ -1590,6 +1966,17 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSetIdentity + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.active_key = active_key @@ -1602,11 +1989,11 @@ class DiskEncryptionSetList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1625,6 +2012,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ super(DiskEncryptionSetList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1633,8 +2027,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1647,6 +2041,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1654,8 +2052,8 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1668,19 +2066,23 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -1697,6 +2099,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -1706,11 +2117,11 @@ def __init__( class DiskEncryptionSetUpdate(msrest.serialization.Model): """disk encryption set update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference + :vartype active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -1725,6 +2136,13 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided + is used to unwrap the encryptionKey. + :paramtype active_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSetUpdate, self).__init__(**kwargs) self.tags = tags self.active_key = active_key @@ -1733,13 +2151,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2019_07_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -1756,6 +2175,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -1767,11 +2196,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1790,6 +2219,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1800,9 +2236,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2019_07_01.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2019_07_01.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -1822,6 +2258,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2019_07_01.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1830,32 +2271,32 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + :vartype disk_m_bps_read_write: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption """ _attribute_map = { @@ -1882,6 +2323,34 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1898,12 +2367,12 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling encryption at rest. - :type disk_encryption_set_id: str - :param type: Required. The type of key used to encrypt the data of the disk. Possible values + :vartype disk_encryption_set_id: str + :ivar type: Required. The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey". - :type type: str or ~azure.mgmt.compute.v2019_07_01.models.EncryptionType + :vartype type: str or ~azure.mgmt.compute.v2019_07_01.models.EncryptionType """ _validation = { @@ -1922,6 +2391,14 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: Required. The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey". + :paramtype type: str or ~azure.mgmt.compute.v2019_07_01.models.EncryptionType + """ super(Encryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id self.type = type @@ -1932,9 +2409,9 @@ class EncryptionSetIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetIdentityType + :vartype type: str or ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetIdentityType :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity. @@ -1962,6 +2439,11 @@ def __init__( type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported. Possible values include: "SystemAssigned". + :paramtype type: str or ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetIdentityType + """ super(EncryptionSetIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -1973,18 +2455,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -2005,6 +2487,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -2014,11 +2510,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -2033,6 +2529,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2019_07_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -2051,15 +2555,15 @@ class Gallery(Resource): :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 description: The description of this Shared Image Gallery resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2094,6 +2598,17 @@ def __init__( identifier: Optional["GalleryIdentifier"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier + """ super(Gallery, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -2113,27 +2628,27 @@ class GalleryApplication(Resource): :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 description: The description of this gallery Application Definition resource. This + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes """ _validation = { @@ -2170,6 +2685,30 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + """ super(GalleryApplication, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -2184,11 +2723,11 @@ class GalleryApplicationList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application + :ivar value: Required. A list of Gallery Applications. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] + :ivar next_link: The uri to fetch the next page of Application Definitions in the Application Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2207,6 +2746,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Gallery Applications. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] + :keyword next_link: The uri to fetch the next page of Application Definitions in the + Application Gallery. Call ListNext() with this to fetch the next page of gallery Application + Definitions. + :paramtype next_link: str + """ super(GalleryApplicationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2215,25 +2762,25 @@ def __init__( class GalleryApplicationUpdate(UpdateResource): """Specifies information about the gallery Application Definition that you want to update. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes """ _attribute_map = { @@ -2258,6 +2805,28 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + """ super(GalleryApplicationUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -2280,12 +2849,12 @@ class GalleryApplicationVersion(Resource): :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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -2323,6 +2892,15 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2334,11 +2912,11 @@ class GalleryApplicationVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call + :ivar value: Required. A list of gallery Application Versions. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] + :ivar next_link: The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2357,6 +2935,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Application Versions. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] + :keyword next_link: The uri to fetch the next page of gallery Application Versions. Call + ListNext() with this to fetch the next page of gallery Application Versions. + :paramtype next_link: str + """ super(GalleryApplicationVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2367,24 +2952,24 @@ class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType """ _validation = { @@ -2410,6 +2995,25 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + """ super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) self.target_regions = target_regions self.replica_count = replica_count @@ -2426,30 +3030,30 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactManage + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool """ _validation = { @@ -2482,6 +3086,32 @@ def __init__( enable_health_check: Optional[bool] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactSource + :keyword manage_actions: + :paramtype manage_actions: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactManage + :keyword enable_health_check: Optional. Whether or not this application reports health. + :paramtype enable_health_check: bool + """ super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source self.manage_actions = manage_actions @@ -2493,10 +3123,10 @@ class GalleryApplicationVersionUpdate(UpdateResource): 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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -2525,6 +3155,13 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2536,8 +3173,8 @@ class GalleryArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2019_07_01.models.ManagedArtifact + :ivar managed_image: Required. The managed artifact. + :vartype managed_image: ~azure.mgmt.compute.v2019_07_01.models.ManagedArtifact """ _validation = { @@ -2554,6 +3191,10 @@ def __init__( managed_image: "ManagedArtifact", **kwargs ): + """ + :keyword managed_image: Required. The managed artifact. + :paramtype managed_image: ~azure.mgmt.compute.v2019_07_01.models.ManagedArtifact + """ super(GalleryArtifactSource, self).__init__(**kwargs) self.managed_image = managed_image @@ -2561,9 +3202,9 @@ def __init__( class GalleryArtifactVersionSource(msrest.serialization.Model): """The gallery artifact version source. - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, + :ivar id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, or user image. - :type id: str + :vartype id: str """ _attribute_map = { @@ -2576,6 +3217,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The id of the gallery artifact version source. Can specify a disk uri, snapshot + uri, or user image. + :paramtype id: str + """ super(GalleryArtifactVersionSource, self).__init__(**kwargs) self.id = id @@ -2587,11 +3233,11 @@ class GalleryDiskImage(msrest.serialization.Model): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource """ _validation = { @@ -2611,6 +3257,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + """ super(GalleryDiskImage, self).__init__(**kwargs) self.size_in_gb = None self.host_caching = host_caching @@ -2626,15 +3279,15 @@ class GalleryDataDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This + :vartype host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + :ivar lun: Required. This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - :type lun: int + :vartype lun: int """ _validation = { @@ -2657,6 +3310,17 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ super(GalleryDataDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) self.lun = lun @@ -2683,6 +3347,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryIdentifier, self).__init__(**kwargs) self.unique_name = None @@ -2700,44 +3366,44 @@ class GalleryImage(Resource): :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 description: The description of this gallery Image Definition resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Image Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery Image Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2019_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery Image Definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery Image Definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed + :ivar purchase_plan: Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2792,6 +3458,46 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Image Definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Image Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery Image Definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery Image Definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed + :keyword purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan + """ super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -2813,12 +3519,12 @@ class GalleryImageIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str + :ivar publisher: Required. The name of the gallery Image Definition publisher. + :vartype publisher: str + :ivar offer: Required. The name of the gallery Image Definition offer. + :vartype offer: str + :ivar sku: Required. The name of the gallery Image Definition SKU. + :vartype sku: str """ _validation = { @@ -2841,6 +3547,14 @@ def __init__( sku: str, **kwargs ): + """ + :keyword publisher: Required. The name of the gallery Image Definition publisher. + :paramtype publisher: str + :keyword offer: Required. The name of the gallery Image Definition offer. + :paramtype offer: str + :keyword sku: Required. The name of the gallery Image Definition SKU. + :paramtype sku: str + """ super(GalleryImageIdentifier, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -2852,11 +3566,11 @@ class GalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image + :ivar value: Required. A list of Shared Image Gallery images. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] + :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2875,6 +3589,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Shared Image Gallery images. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] + :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. + :paramtype next_link: str + """ super(GalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2885,42 +3606,42 @@ class GalleryImageUpdate(UpdateResource): 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 description: The description of this gallery Image Definition resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Image Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery Image Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2019_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery Image Definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery Image Definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed + :ivar purchase_plan: Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2966,6 +3687,44 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Image Definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Image Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery Image Definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery Image Definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2019_07_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2019_07_01.models.Disallowed + :keyword purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2019_07_01.models.ImagePurchasePlan + """ super(GalleryImageUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -2995,19 +3754,20 @@ class GalleryImageVersion(Resource): :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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery Image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery Image Version. :vartype replication_status: ~azure.mgmt.compute.v2019_07_01.models.ReplicationStatus """ @@ -3042,6 +3802,18 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery Image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -3054,11 +3826,11 @@ class GalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str + :ivar value: Required. A list of gallery Image Versions. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] + :ivar next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() with + this to fetch the next page of gallery Image Versions. + :vartype next_link: str """ _validation = { @@ -3077,6 +3849,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Image Versions. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] + :keyword next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() + with this to fetch the next page of gallery Image Versions. + :paramtype next_link: str + """ super(GalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3087,24 +3866,24 @@ class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase) Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType """ _validation = { @@ -3130,18 +3909,37 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_07_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + """ super(GalleryImageVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) class GalleryImageVersionStorageProfile(msrest.serialization.Model): """This is the storage profile of a Gallery Image Version. - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.GalleryDataDiskImage] + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.GalleryDataDiskImage] """ _attribute_map = { @@ -3158,6 +3956,14 @@ def __init__( data_disk_images: Optional[List["GalleryDataDiskImage"]] = None, **kwargs ): + """ + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.GalleryDataDiskImage] + """ super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) self.source = source self.os_disk_image = os_disk_image @@ -3169,17 +3975,18 @@ class GalleryImageVersionUpdate(UpdateResource): 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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery Image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery Image Version. :vartype replication_status: ~azure.mgmt.compute.v2019_07_01.models.ReplicationStatus """ @@ -3205,6 +4012,16 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery Image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -3217,11 +4034,11 @@ class GalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + :ivar value: Required. A list of galleries. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.Gallery] + :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3240,6 +4057,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of galleries. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.Gallery] + :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :paramtype next_link: str + """ super(GalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3252,11 +4076,11 @@ class GalleryOSDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource """ _validation = { @@ -3276,6 +4100,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2019_07_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource + """ super(GalleryOSDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) @@ -3284,13 +4115,13 @@ class GalleryUpdate(UpdateResource): 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 description: The description of this Shared Image Gallery resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -3316,6 +4147,15 @@ def __init__( identifier: Optional["GalleryIdentifier"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2019_07_01.models.GalleryIdentifier + """ super(GalleryUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -3327,10 +4167,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2019_07_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2019_07_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -3350,6 +4190,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2019_07_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -3358,7 +4204,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -3404,7 +4250,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2019_07_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -3417,6 +4263,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -3434,19 +4329,20 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes """ _validation = { @@ -3479,6 +4375,20 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -3489,29 +4399,31 @@ def __init__( class ImageDisk(msrest.serialization.Model): """Describes a image disk. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_07_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -3536,6 +4448,33 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + """ super(ImageDisk, self).__init__(**kwargs) self.snapshot = snapshot self.managed_disk = managed_disk @@ -3551,33 +4490,35 @@ class ImageDataDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_07_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters - :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype lun: int """ _validation = { @@ -3608,6 +4549,37 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + :keyword 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. + :paramtype lun: int + """ 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 @@ -3617,12 +4589,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -3641,6 +4613,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -3651,11 +4631,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2019_07_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3674,6 +4654,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3684,36 +4671,38 @@ class ImageOSDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_07_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters - :param os_type: Required. This property allows you to specify the type of the OS that is + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + :ivar 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.v2019_07_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes """ _validation = { @@ -3747,6 +4736,41 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemStateTypes + """ 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 @@ -3755,12 +4779,12 @@ def __init__( class ImagePurchasePlan(msrest.serialization.Model): """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str """ _attribute_map = { @@ -3777,6 +4801,14 @@ def __init__( product: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product ID. + :paramtype product: str + """ super(ImagePurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3788,21 +4820,21 @@ class ImageReference(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype 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'. @@ -3832,6 +4864,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -3843,19 +4892,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2019_07_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_07_01.models.ImageOSDisk + :ivar 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.v2019_07_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -3872,6 +4921,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_07_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -3883,17 +4947,18 @@ class ImageUpdate(UpdateResource): 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.v2019_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes """ _validation = { @@ -3917,6 +4982,18 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -3927,10 +5004,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -3945,6 +5022,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -3953,16 +5036,16 @@ def __init__( 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.v2019_07_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2019_07_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -3983,6 +5066,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2019_07_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -3996,10 +5091,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -4019,6 +5114,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -4029,10 +5130,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -4052,6 +5153,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -4062,10 +5169,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2019_07_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SubResource """ _validation = { @@ -4085,6 +5192,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -4095,10 +5208,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2019_07_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SubResource """ _validation = { @@ -4118,6 +5231,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -4126,16 +5245,16 @@ def __init__( 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 + :ivar 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.v2019_07_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2019_07_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool """ _attribute_map = { @@ -4152,6 +5271,18 @@ def __init__( provision_vm_agent: Optional[bool] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2019_07_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -4163,11 +5294,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2019_07_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4186,6 +5317,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4196,19 +5334,19 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -4237,6 +5375,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -4267,6 +5420,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -4292,6 +5447,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -4299,23 +5456,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2019_07_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -4340,6 +5497,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2019_07_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -4355,8 +5531,8 @@ class ManagedArtifact(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The managed artifact id. - :type id: str + :ivar id: Required. The managed artifact id. + :vartype id: str """ _validation = { @@ -4373,6 +5549,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ super(ManagedArtifact, self).__init__(**kwargs) self.id = id @@ -4380,15 +5560,17 @@ def __init__( 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: + :ivar id: Resource Id. + :vartype id: str + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -4405,6 +5587,19 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -4413,11 +5608,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -4432,6 +5627,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -4439,9 +5641,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2019_07_01.models.NetworkInterfaceReference] """ @@ -4455,6 +5657,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2019_07_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -4464,48 +5672,48 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2019_07_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :ivar 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.v2019_07_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :ivar 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.v2019_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_07_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2019_07_01.models.DiffDiskSettings + :ivar 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.v2019_07_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :ivar 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.v2019_07_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.ManagedDiskParameters """ _validation = { @@ -4542,6 +5750,50 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2019_07_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -4561,9 +5813,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes """ _validation = { @@ -4580,6 +5832,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -4587,30 +5844,29 @@ def __init__( 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. + :ivar 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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -4625,8 +5881,8 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 @@ -4636,28 +5892,27 @@ class OSProfile(msrest.serialization.Model): 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration + :ivar 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.v2019_07_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar require_guest_provision_signal: Specifies whether the guest provision signal is required to infer provision success of the virtual machine. - :type require_guest_provision_signal: bool + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -4686,6 +5941,79 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword require_guest_provision_signal: Specifies whether the guest provision signal is + required to infer provision success of the virtual machine. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -4701,15 +6029,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -4728,6 +6056,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4748,15 +6087,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -4770,8 +6109,8 @@ class ProximityPlacementGroup(Resource): placement group. :vartype availability_sets: list[~azure.mgmt.compute.v2019_07_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus """ _validation = { @@ -4806,6 +6145,20 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -4819,10 +6172,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2019_07_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -4841,6 +6194,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4849,8 +6208,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -4863,6 +6222,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -4871,13 +6234,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -4900,6 +6263,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -4909,10 +6281,10 @@ def __init__( class RecommendedMachineConfiguration(msrest.serialization.Model): """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange """ _attribute_map = { @@ -4927,6 +6299,12 @@ def __init__( memory: Optional["ResourceRange"] = None, **kwargs ): + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2019_07_01.models.ResourceRange + """ super(RecommendedMachineConfiguration, self).__init__(**kwargs) self.v_cp_us = v_cp_us self.memory = memory @@ -4958,6 +6336,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -4997,6 +6377,8 @@ def __init__( self, **kwargs ): + """ + """ super(RegionalReplicationStatus, self).__init__(**kwargs) self.region = None self.state = None @@ -5032,6 +6414,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = None @@ -5042,22 +6426,22 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 interval_length: Required. Interval value in minutes used to create LogAnalytics call + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar 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.v2019_07_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2019_07_01.models.IntervalInMins """ _validation = { @@ -5089,6 +6473,24 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2019_07_01.models.IntervalInMins + """ 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, **kwargs) self.interval_length = interval_length @@ -5096,10 +6498,10 @@ def __init__( class ResourceRange(msrest.serialization.Model): """Describes the resource range. - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int """ _attribute_map = { @@ -5114,6 +6516,12 @@ def __init__( max: Optional[int] = None, **kwargs ): + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ super(ResourceRange, self).__init__(**kwargs) self.min = min self.max = max @@ -5149,6 +6557,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -5158,26 +6568,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -5202,6 +6612,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -5243,6 +6675,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -5285,6 +6719,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -5305,10 +6741,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -5350,6 +6786,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -5362,17 +6804,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_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 + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -5401,6 +6843,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -5414,21 +6869,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2019_07_01.models.RunCommandParameterDefinition] """ _validation = { @@ -5462,6 +6917,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2019_07_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -5472,13 +6945,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2019_07_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2019_07_01.models.RunCommandInputParameter] """ _validation = { @@ -5499,6 +6972,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2019_07_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -5510,10 +6992,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -5533,6 +7015,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -5543,11 +7031,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2019_07_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5566,6 +7054,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5576,14 +7071,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -5607,6 +7102,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -5617,8 +7122,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5631,6 +7136,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -5638,7 +7147,7 @@ def __init__( 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. + :ivar 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 @@ -5652,7 +7161,7 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetScaleInRules] """ @@ -5666,6 +7175,24 @@ def __init__( rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetScaleInRules] + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules @@ -5673,9 +7200,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2019_07_01.models.TerminateNotificationProfile """ @@ -5689,6 +7216,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2019_07_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -5696,14 +7229,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -5720,6 +7253,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5739,45 +7282,45 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption """ _validation = { @@ -5828,6 +7371,37 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2019_07_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -5849,11 +7423,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -5872,6 +7446,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5882,9 +7463,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2019_07_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2019_07_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -5904,6 +7485,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2019_07_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -5912,24 +7498,24 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption """ _attribute_map = { @@ -5952,6 +7538,26 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_07_01.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -5964,8 +7570,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -5978,6 +7584,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -5985,8 +7595,8 @@ def __init__( 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.v2019_07_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2019_07_01.models.SshPublicKey] """ _attribute_map = { @@ -5999,6 +7609,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2019_07_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -6006,15 +7620,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -6029,6 +7643,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -6037,21 +7662,21 @@ def __init__( 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 + :ivar 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.v2019_07_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageReference + :ivar 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.v2019_07_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_07_01.models.OSDisk + :ivar 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.v2019_07_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.DataDisk] """ _attribute_map = { @@ -6068,6 +7693,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_07_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -6095,6 +7737,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -6102,11 +7746,11 @@ def __init__( class SubResourceWithColocationStatus(SubResource): """SubResourceWithColocationStatus. - :param id: Resource Id. - :type id: str - :param colocation_status: Describes colocation status of a resource in the Proximity Placement + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus + :vartype colocation_status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus """ _attribute_map = { @@ -6121,6 +7765,13 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword colocation_status: Describes colocation status of a resource in the Proximity + Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus + """ super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) self.colocation_status = colocation_status @@ -6130,14 +7781,14 @@ class TargetRegion(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per + :ivar name: Required. The name of the region. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. + :vartype regional_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType """ _validation = { @@ -6158,6 +7809,17 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword name: Required. The name of the region. + :paramtype name: str + :keyword regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :paramtype regional_replica_count: int + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType + """ super(TargetRegion, self).__init__(**kwargs) self.name = name self.regional_replica_count = regional_replica_count @@ -6167,13 +7829,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -6188,6 +7850,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -6198,19 +7869,19 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -6239,6 +7910,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ 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, **kwargs) @@ -6272,6 +7958,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -6320,6 +8008,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -6359,6 +8049,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -6368,19 +8060,19 @@ def __init__( 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.v2019_07_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2019_07_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.AutomaticOSUpgradePolicy """ @@ -6398,6 +8090,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2019_07_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2019_07_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -6413,12 +8121,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2019_07_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2019_07_01.models.UsageName """ _validation = { @@ -6445,6 +8153,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2019_07_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -6454,10 +8170,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -6472,6 +8188,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -6482,16 +8204,16 @@ class UserArtifactManage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param install: Required. Required. The path and arguments to install the gallery application. + :ivar install: Required. Required. The path and arguments to install the gallery application. This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. + :vartype install: str + :ivar remove: Required. Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not + :vartype remove: str + :ivar update: Optional. The path and arguments to update the gallery application. If not present, then update operation will invoke remove command on the previous version and install command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str + :vartype update: str """ _validation = { @@ -6513,6 +8235,18 @@ def __init__( update: Optional[str] = None, **kwargs ): + """ + :keyword install: Required. Required. The path and arguments to install the gallery + application. This is limited to 4096 characters. + :paramtype install: str + :keyword remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :paramtype remove: str + :keyword update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :paramtype update: str + """ super(UserArtifactManage, self).__init__(**kwargs) self.install = install self.remove = remove @@ -6524,12 +8258,12 @@ class UserArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + :ivar media_link: Required. Required. The mediaLink of the artifact, must be a readable storage + page blob. + :vartype media_link: str + :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. - :type default_configuration_link: str + :vartype default_configuration_link: str """ _validation = { @@ -6548,6 +8282,14 @@ def __init__( default_configuration_link: Optional[str] = None, **kwargs ): + """ + :keyword media_link: Required. Required. The mediaLink of the artifact, must be a readable + storage page blob. + :paramtype media_link: str + :keyword default_configuration_link: Optional. The defaultConfigurationLink of the artifact, + must be a readable storage page blob. + :paramtype default_configuration_link: str + """ super(UserArtifactSource, self).__init__(**kwargs) self.media_link = media_link self.default_configuration_link = default_configuration_link @@ -6578,6 +8320,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6586,21 +8330,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -6615,6 +8359,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -6623,12 +8384,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2019_07_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2019_07_01.models.VaultCertificate] """ _attribute_map = { @@ -6643,6 +8404,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2019_07_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -6651,8 +8420,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -6665,6 +8434,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -6682,38 +8455,38 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_07_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :ivar 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.v2019_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :ivar 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 @@ -6726,42 +8499,41 @@ class VirtualMachine(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.v2019_07_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 + :vartype availability_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar 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.v2019_07_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar 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.v2019_07_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.v2019_07_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, the only supported value is 'Deallocate' 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2019_07_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.v2019_07_01.models.SubResource + :vartype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6769,7 +8541,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -6839,6 +8611,91 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, the only + supported value is 'Deallocate' 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -6866,13 +8723,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6889,6 +8746,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -6900,13 +8766,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -6929,6 +8795,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -6940,8 +8815,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -6973,6 +8848,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -6993,33 +8872,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2019_07_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -7062,6 +8942,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -7077,12 +8985,12 @@ def __init__( 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.v2019_07_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus """ _attribute_map = { @@ -7099,6 +9007,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -7118,23 +9034,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -7169,6 +9085,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -7180,16 +9115,16 @@ def __init__( 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.v2019_07_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -7210,6 +9145,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -7221,8 +9168,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -7235,6 +9182,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -7242,26 +9193,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -7288,6 +9239,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -7319,6 +9292,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -7334,15 +9309,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2019_07_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2019_07_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_07_01.models.UserAssignedIdentitiesValue] """ @@ -7365,6 +9340,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2019_07_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2019_07_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -7377,16 +9364,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -7410,6 +9397,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -7421,29 +9420,30 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2019_07_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2019_07_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2019_07_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes """ _validation = { @@ -7477,6 +9477,33 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2019_07_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2019_07_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2019_07_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2019_07_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationTypes + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -7488,38 +9515,38 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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.v2019_07_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.v2019_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2019_07_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2019_07_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_07_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -7556,6 +9583,41 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_07_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2019_07_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_07_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -7577,11 +9639,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2019_07_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7600,6 +9662,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7608,9 +9677,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -7623,6 +9692,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -7640,61 +9714,61 @@ class VirtualMachineScaleSet(Resource): :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.v2019_07_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :ivar 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.v2019_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2019_07_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar single_placement_group: When true this limits the scale set to a single placement group, of max size 100 virtual machines. - :type single_placement_group: bool - :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2019_07_01.models.SubResource - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar 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.v2019_07_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :ivar 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.v2019_07_01.models.ScaleInPolicy + :vartype scale_in_policy: ~azure.mgmt.compute.v2019_07_01.models.ScaleInPolicy """ _validation = { @@ -7753,6 +9827,61 @@ def __init__( scale_in_policy: Optional["ScaleInPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2019_07_01.models.ScaleInPolicy + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -7778,39 +9907,39 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2019_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetManagedDiskParameters - :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + :ivar 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. + :vartype disk_iops_read_write: long + :ivar 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 + :vartype disk_m_bps_read_write: long """ _validation = { @@ -7844,6 +9973,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword 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. + :paramtype disk_iops_read_write: long + :keyword 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. + :paramtype disk_m_bps_read_write: long + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -7863,34 +10027,34 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -7928,6 +10092,32 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.type = None @@ -7947,11 +10137,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2019_07_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7970,6 +10160,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7978,8 +10175,9 @@ def __init__( 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.v2019_07_01.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -7992,6 +10190,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -8007,30 +10210,30 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -8068,6 +10271,30 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -8093,17 +10320,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2019_07_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: + :vartype type: str or ~azure.mgmt.compute.v2019_07_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -8126,6 +10352,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2019_07_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -8158,6 +10398,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -8174,8 +10416,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ _validation = { @@ -8195,6 +10437,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -8223,6 +10469,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -8232,39 +10480,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2019_07_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2019_07_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2019_07_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :ivar 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 load balancer. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :ivar 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 load balancer. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_07_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 load balancer. - :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] """ _validation = { @@ -8299,6 +10548,43 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2019_07_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword 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 load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -8314,10 +10600,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -8332,6 +10618,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -8342,11 +10634,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2019_07_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2019_07_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8365,6 +10658,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2019_07_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8375,11 +10676,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2019_07_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8398,6 +10699,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8408,11 +10716,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2019_07_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8431,6 +10739,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8441,11 +10756,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2019_07_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8464,6 +10779,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8472,14 +10794,16 @@ def __init__( 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. 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. Possible values include: + :ivar storage_account_type: 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. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -8494,6 +10818,18 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetParameters + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -8504,26 +10840,26 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -8554,6 +10890,28 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -8567,8 +10925,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -8581,6 +10939,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -8588,12 +10950,12 @@ def __init__( 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 + :ivar 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.v2019_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -8609,6 +10971,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -8619,43 +10990,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2019_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_07_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :ivar 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.v2019_07_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2019_07_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2019_07_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -8691,6 +11062,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_07_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2019_07_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_07_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -8707,25 +11118,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -8740,27 +11150,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration + :ivar 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.v2019_07_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.v2019_07_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] """ _attribute_map = { @@ -8785,6 +11195,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -8800,21 +11266,21 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar 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.v2019_07_01.models.IPVersion + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2019_07_01.models.IPVersion """ _validation = { @@ -8841,6 +11307,23 @@ def __init__( public_ip_address_version: Optional[Union[str, "IPVersion"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2019_07_01.models.IPVersion + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -8855,10 +11338,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -8875,6 +11358,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -8882,9 +11371,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -8897,19 +11386,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -8924,6 +11418,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -8957,6 +11460,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -8998,6 +11503,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -9008,21 +11515,22 @@ def __init__( 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 + :ivar 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.v2019_07_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageReference + :ivar 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.v2019_07_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2019_07_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -9039,6 +11547,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -9048,45 +11574,45 @@ def __init__( 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.v2019_07_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2019_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2019_07_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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.v2019_07_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :ivar 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.v2019_07_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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2019_07_01.models.ScaleInPolicy + :ivar 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.v2019_07_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource """ _attribute_map = { @@ -9123,6 +11649,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2019_07_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2019_07_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_07_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2019_07_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -9141,34 +11710,34 @@ def __init__( class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): """Describes a virtual machine scale set network profile's IP configuration. - :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.v2019_07_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2019_07_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2019_07_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.SubResource] """ _attribute_map = { @@ -9199,6 +11768,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2019_07_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2019_07_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -9214,25 +11815,25 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -9259,6 +11860,27 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -9272,12 +11894,12 @@ def __init__( 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 + :ivar 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.v2019_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -9293,6 +11915,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -9301,23 +11932,23 @@ def __init__( 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.v2019_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2019_07_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: + :vartype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -9341,6 +11972,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2019_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_07_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -9353,14 +12004,14 @@ def __init__( 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.v2019_07_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] """ _attribute_map = { @@ -9379,6 +12030,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_07_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -9389,12 +12050,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -9412,6 +12073,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -9421,12 +12091,13 @@ def __init__( 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.v2019_07_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -9443,6 +12114,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2019_07_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -9452,26 +12132,28 @@ def __init__( 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.v2019_07_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2019_07_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. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar 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.v2019_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -9498,6 +12180,30 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -9522,20 +12228,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2019_07_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2019_07_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -9548,26 +12254,26 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile + :ivar 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.v2019_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :ivar 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 @@ -9577,10 +12283,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2019_07_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2019_07_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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -9588,12 +12294,12 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMProtectionPolicy """ @@ -9659,6 +12365,61 @@ def __init__( protection_policy: Optional["VirtualMachineScaleSetVMProtectionPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMProtectionPolicy + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -9708,6 +12469,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -9716,10 +12479,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -9732,6 +12495,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -9741,8 +12510,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -9759,6 +12528,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -9768,34 +12541,34 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2019_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2019_07_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2019_07_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_07_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -9831,6 +12604,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2019_07_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2019_07_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_07_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -9850,11 +12651,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9873,6 +12674,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9881,8 +12689,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -9896,6 +12704,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -9903,24 +12716,24 @@ def __init__( 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.v2019_07_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -9928,24 +12741,25 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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. + :vartype license_type: str + :ivar 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.v2019_07_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype priority: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, the only supported value is 'Deallocate' 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :ivar 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.v2019_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -9976,6 +12790,52 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, the only + supported value is 'Deallocate' 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2019_07_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -9992,13 +12852,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -10013,6 +12873,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -10021,20 +12890,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -10057,6 +12926,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -10069,8 +12954,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSize] """ _attribute_map = { @@ -10083,6 +12968,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -10112,6 +13001,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -10122,34 +13013,34 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_07_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :ivar 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.v2019_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :ivar 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 @@ -10162,42 +13053,41 @@ class VirtualMachineUpdate(UpdateResource): 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.v2019_07_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 + :vartype availability_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar 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.v2019_07_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar 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.v2019_07_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.v2019_07_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, the only supported value is 'Deallocate' 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2019_07_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.v2019_07_01.models.SubResource + :vartype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2019_07_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.v2019_07_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -10205,7 +13095,7 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -10264,6 +13154,89 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_07_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_07_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_07_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_07_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2019_07_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_07_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_07_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2019_07_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, the only + supported value is 'Deallocate' 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_07_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2019_07_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -10290,11 +13263,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -10307,6 +13280,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -10314,28 +13294,28 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". + :vartype enable_automatic_updates: bool + :ivar 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 + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2019_07_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2019_07_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2019_07_01.models.WinRMConfiguration """ _attribute_map = { @@ -10356,6 +13336,30 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword 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 + `_. + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2019_07_01.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2019_07_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -10367,8 +13371,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2019_07_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2019_07_01.models.WinRMListener] """ _attribute_map = { @@ -10381,6 +13385,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2019_07_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -10388,18 +13396,18 @@ def __init__( 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 + :ivar 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.v2019_07_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2019_07_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -10414,6 +13422,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2019_07_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py index dc5c5e4e98be..be5d4be4ee96 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2019_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2019_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py index be177b16e776..4809a290f683 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py @@ -5,23 +5,242 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +264,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +292,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +325,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +355,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +384,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +411,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,13 +434,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -262,27 +458,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,22 +482,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -319,35 +509,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -365,22 +551,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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.v2019_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -388,34 +577,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -433,6 +617,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py index d84df318e303..8844782dc51b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2019_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2019_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHost" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -449,7 +616,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -461,30 +629,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -498,15 +655,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -515,8 +674,10 @@ def list_by_host_group( :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.v2019_07_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -524,36 +685,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py index 9844211b0bf9..55af44c46e65 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskEncryptionSetsOperations(object): """DiskEncryptionSetsOperations operations. @@ -49,43 +274,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -103,16 +317,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. @@ -126,15 +342,19 @@ def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,27 +366,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,47 +392,37 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -236,16 +440,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. @@ -259,15 +465,19 @@ def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +489,21 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,15 +515,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. @@ -338,27 +543,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,41 +567,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,13 +605,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. @@ -436,15 +623,17 @@ def begin_delete( :type disk_encryption_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -458,21 +647,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -484,21 +666,24 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption 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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -506,35 +691,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,21 +733,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -574,34 +758,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -619,6 +798,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py index 29a5731d3ffc..507976595c31 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2019_07_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2019_07_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_07_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py index cafbc5f9220c..67f2008e2ad2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleriesOperations(object): """GalleriesOperations operations. @@ -49,43 +274,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -106,16 +320,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Create or update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -127,15 +343,18 @@ def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2019_07_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +366,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,47 +392,37 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -233,16 +436,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -254,15 +459,18 @@ def begin_update( :type gallery: ~azure.mgmt.compute.v2019_07_01.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,27 +482,21 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -306,15 +508,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> "_models.Gallery": """Retrieves information about a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -331,27 +534,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -365,41 +558,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -412,13 +596,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -427,15 +612,17 @@ def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -449,21 +636,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -475,14 +655,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a resource group. :param resource_group_name: The name of the resource group. @@ -497,35 +678,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -543,16 +720,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -565,34 +743,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,6 +783,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py index 5d55e9ba2aa2..5b85ed819fa0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_application_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationVersionsOperations(object): """GalleryApplicationVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -139,18 +348,24 @@ def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +379,21 @@ def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +405,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -256,18 +453,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -285,18 +484,24 @@ def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +515,21 @@ def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +541,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": """Retrieves information about a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -381,31 +579,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,45 +606,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -470,15 +648,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -494,15 +673,17 @@ def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -518,23 +699,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -546,16 +718,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationVersionList"]: """List gallery Application Versions in a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -567,8 +740,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -576,37 +751,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -624,6 +797,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py index ee6f8e1d34f2..d5c47ba519c1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationsOperations(object): """GalleryApplicationsOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -135,15 +330,20 @@ def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -156,28 +356,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,49 +382,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -245,17 +428,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -271,15 +456,20 @@ def begin_update( :type gallery_application: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +482,21 @@ def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,16 +508,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> "_models.GalleryApplication": """Retrieves information about a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -355,28 +539,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,43 +564,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -439,14 +604,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application. :param resource_group_name: The name of the resource group. @@ -458,15 +624,17 @@ def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -481,22 +649,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -508,15 +668,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationList"]: """List gallery Application Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -525,8 +686,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -534,36 +697,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -581,6 +741,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py index f774dc68eeda..b07f7815c7cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_image_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImageVersionsOperations(object): """GalleryImageVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Create or update a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -142,15 +351,20 @@ def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +378,21 @@ def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +404,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -256,18 +452,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Update a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -288,15 +486,20 @@ def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +513,21 @@ def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +539,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": """Retrieves information about a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -380,31 +576,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -418,45 +603,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -469,15 +645,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -492,15 +669,17 @@ def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -516,23 +695,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,16 +714,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageVersionList"]: """List gallery Image Versions in a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -565,8 +736,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -574,37 +747,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -622,6 +793,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py index d5a044464e84..e84938151a5f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImagesOperations(object): """GalleryImagesOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Create or update a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -134,15 +329,19 @@ def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,28 +354,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -188,49 +380,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Update a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -270,15 +454,19 @@ def begin_update( :type gallery_image: ~azure.mgmt.compute.v2019_07_01.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +479,21 @@ def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,16 +505,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": """Retrieves information about a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -353,28 +535,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,43 +560,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,14 +600,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image. :param resource_group_name: The name of the resource group. @@ -456,15 +620,17 @@ def begin_delete( :type gallery_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,22 +645,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -506,15 +664,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageList"]: """List gallery Image Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -532,36 +691,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -579,6 +735,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py index 5e6fab4849ea..99f6acb24308 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py index a24568247b8c..1c6c70158cf1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py index 6de71ca64e83..7977fe32500f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2019_07_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py index 7936f529664a..14f31ae6ad19 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = _SERIALIZER.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +294,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +327,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +357,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +386,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +413,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,14 +436,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -264,29 +464,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,18 +489,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2019_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -319,34 +512,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,24 +552,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -389,35 +580,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +622,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py index 9a475cb3f857..a9fde3060211 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2019_07_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2019_07_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_07_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2019-07-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py index ce8b45dc92c3..692d746ace1c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py index fc9094f0a093..24ba8adebfa6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2019_07_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extensions_operations.py index 218522376001..397fcd24745f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2019_07_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_images_operations.py index 624a4787d2de..cc3c0c3ae7dd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2019_07_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_run_commands_operations.py index 118665e79827..58f90ce2606e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py index 84e38e7b7fdf..2b6fa99c4f3f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +320,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +350,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +376,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to update an extension. :param resource_group_name: The name of the resource group. @@ -265,18 +449,24 @@ def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -289,28 +479,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -322,41 +505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +544,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -387,15 +563,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +588,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,17 +607,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -468,30 +639,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +665,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -521,8 +683,10 @@ def list( :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.v2019_07_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -530,36 +694,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -577,6 +738,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 1a333b14522e..2b039141d121 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 37cc76401686..dfd79d0d6fbc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,24 +5,246 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMExtensionsOperations(object): """VirtualMachineScaleSetVMExtensionsOperations operations. @@ -48,47 +270,36 @@ def __init__(self, client, config, serializer, deserializer): 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.VirtualMachineExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtension" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,18 +317,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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.VirtualMachineExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineExtension"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -133,15 +346,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +373,21 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +399,41 @@ def get_long_running_output(pipeline_response): ) 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.VirtualMachineExtensionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtension" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +447,20 @@ def _update_initial( 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 + + @distributed_trace 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.VirtualMachineExtensionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineExtension"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -271,18 +473,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +504,21 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -330,45 +530,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,15 +571,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -402,15 +593,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,23 +619,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,18 +638,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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.VirtualMachineExtension" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -488,31 +673,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,17 +700,19 @@ def get( 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 + + @distributed_trace 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.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of an instance in Virtual Machine Scaleset. :param resource_group_name: The name of the resource group. @@ -557,30 +733,19 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,4 +759,6 @@ def list( 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/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py index 249d70471d65..b13468b0b94c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,539 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +563,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +606,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +625,22 @@ def begin_reimage( :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.v2019_07_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +653,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +676,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +715,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +735,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +760,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +779,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +818,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +839,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +864,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +883,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +933,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +959,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +985,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,41 +1011,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,14 +1050,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -609,15 +1069,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -632,22 +1094,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -659,17 +1113,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -678,7 +1133,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -690,30 +1146,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -727,16 +1172,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -755,28 +1202,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -790,18 +1227,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -818,8 +1257,10 @@ def list( '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.v2019_07_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -827,42 +1268,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -880,6 +1318,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -887,40 +1326,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -933,15 +1362,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -958,15 +1388,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -982,22 +1414,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1009,41 +1433,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1056,14 +1472,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1074,15 +1491,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1097,22 +1516,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1124,41 +1535,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1171,14 +1574,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1189,15 +1593,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1212,22 +1618,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1239,41 +1637,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1286,14 +1676,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1305,15 +1696,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1328,22 +1721,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1355,41 +1740,33 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1402,14 +1779,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in a VMScaleSet, moves it to an already updated node, and powers it back on during the self-service phase of planned maintenance. @@ -1421,15 +1799,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1444,22 +1824,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1471,49 +1843,39 @@ def get_long_running_output(pipeline_response): ) 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 _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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1529,17 +1891,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1552,15 +1916,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2019_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1573,28 +1941,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1606,4 +1967,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py index b056e0c7cdaa..8776582ddae3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,852 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +876,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +919,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +941,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +966,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +992,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +1036,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1058,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1083,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,39 +1109,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,13 +1146,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -361,15 +1162,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +1186,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -409,15 +1205,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -434,27 +1231,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,48 +1255,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,14 +1302,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -539,18 +1320,22 @@ def begin_deallocate( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,24 +1347,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,45 +1370,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -642,14 +1413,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -657,18 +1429,22 @@ def begin_delete_instances( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -680,24 +1456,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -709,15 +1479,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -734,27 +1505,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -768,21 +1529,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -790,35 +1555,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,23 +1597,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2019_07_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -860,34 +1624,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,18 +1664,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -925,8 +1685,10 @@ def list_skus( :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.v2019_07_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -934,36 +1696,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -981,18 +1740,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1000,8 +1760,10 @@ def get_os_upgrade_history( :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.v2019_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1009,36 +1771,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,6 +1815,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1063,47 +1823,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1116,15 +1866,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1138,18 +1889,22 @@ def begin_power_off( 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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1162,24 +1917,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1191,48 +1940,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1245,14 +1986,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1260,18 +2002,22 @@ def begin_restart( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1283,24 +2029,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1312,48 +2052,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1366,14 +2098,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1381,18 +2114,22 @@ def begin_start( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1404,24 +2141,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1433,48 +2164,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1487,14 +2210,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1503,18 +2227,22 @@ def begin_redeploy( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1526,24 +2254,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1555,48 +2277,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1609,14 +2323,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1627,18 +2342,22 @@ def begin_perform_maintenance( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1650,24 +2369,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1679,45 +2392,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1730,14 +2435,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1745,18 +2451,22 @@ def begin_update_instances( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1768,24 +2478,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1797,48 +2501,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1851,14 +2547,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1868,18 +2565,22 @@ def begin_reimage( :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.v2019_07_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1891,24 +2592,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1920,48 +2615,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1974,14 +2661,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1990,18 +2678,22 @@ def begin_reimage_all( :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2013,24 +2705,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2042,16 +2728,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2072,28 +2759,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2107,16 +2784,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to true for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2124,7 +2803,8 @@ def convert_to_single_placement_group( :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.v2019_07_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2019_07_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 @@ -2135,30 +2815,22 @@ def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2170,3 +2842,4 @@ def convert_to_single_placement_group( return cls(pipeline_response, None, {}) convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py index 3b8e850c6868..07973ddf09ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py index efa2a520e954..98259df8f5b2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py @@ -5,25 +5,756 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +778,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +800,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +842,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +850,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +891,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +914,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_07_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +939,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +965,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +1013,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. @@ -324,15 +1036,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2019_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -344,27 +1060,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,47 +1086,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -434,16 +1134,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -454,15 +1156,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2019_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,27 +1180,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -506,39 +1206,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -551,13 +1243,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -566,15 +1259,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -588,21 +1283,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -614,23 +1302,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -642,29 +1332,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -678,15 +1357,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -703,27 +1384,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -737,39 +1408,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -782,13 +1446,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. :code:`
    `For Windows, please refer to `Convert a virtual machine from unmanaged disks to managed disks. @@ -802,15 +1467,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -824,21 +1491,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -850,39 +1510,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -895,13 +1547,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -911,15 +1564,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -933,21 +1588,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -959,15 +1607,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 @@ -989,25 +1638,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,20 +1661,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1041,35 +1685,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1087,17 +1727,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - status_only=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + status_only: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -1105,8 +1746,10 @@ def list_all( 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.v2019_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1114,36 +1757,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1161,18 +1799,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1181,8 +1820,10 @@ def list_available_sizes( :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.v2019_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1190,36 +1831,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1237,6 +1875,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1244,38 +1883,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1288,14 +1917,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1309,15 +1939,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1332,21 +1964,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1358,41 +1983,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1405,13 +2020,14 @@ def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace def begin_reapply( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to reapply a virtual machine's state. :param resource_group_name: The name of the resource group. @@ -1420,15 +2036,17 @@ def begin_reapply( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1442,21 +2060,14 @@ def begin_reapply( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1468,39 +2079,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1513,13 +2116,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1528,15 +2132,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1550,21 +2156,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1576,39 +2175,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1621,13 +2212,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1636,15 +2228,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1658,21 +2252,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1684,39 +2271,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1729,13 +2308,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1744,15 +2324,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1766,21 +2348,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1792,48 +2367,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1846,14 +2413,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1864,15 +2432,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1884,24 +2455,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1913,39 +2478,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1958,13 +2515,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine, moves it to an already updated node, and powers it back on during the self-service phase of planned maintenance. @@ -1974,15 +2532,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1996,21 +2556,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2022,47 +2575,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2019-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2078,16 +2621,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2098,15 +2643,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2019_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2118,27 +2667,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2150,4 +2693,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py index a519b1cedc3c..77e6d44c25a5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskEncryptionSetsOperations, DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -33,57 +29,63 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2019_11_01.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2019_11_01.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2019_11_01.operations.DiskEncryptionSetsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py index ff8b47047489..06d9c16ac2cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json index 827e6ddb45f9..7f9e6b11edac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "disks": "DisksOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py index e9177ccb618d..692b026fc28c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py @@ -6,24 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskEncryptionSetsOperations, DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -31,55 +29,63 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2019_11_01.aio.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2019_11_01.aio.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2019_11_01.aio.operations.DiskEncryptionSetsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py index 2c331f35d733..b1f2b0975a96 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py index 776516fe17aa..b8dcd8ecbce6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,20 @@ async def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore async def _update_initial( @@ -186,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,8 +293,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -329,27 +321,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -363,8 +345,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -376,27 +360,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,6 +383,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -425,15 +401,17 @@ async def begin_delete( :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -447,21 +425,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,8 +444,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +458,10 @@ def list_by_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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -494,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -552,8 +525,10 @@ def list( """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -561,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py index 3ee1aa5fe4a7..fd1c8c56e33f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2019_11_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2019_11_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_11_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py index cd62b08fbcb9..5a4a701427f8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2019_11_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2019_11_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_11_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/__init__.py index aaafc8a91c92..4fdd463855a1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/__init__.py @@ -6,62 +6,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import CreationData - from ._models_py3 import Disk - from ._models_py3 import DiskEncryptionSet - from ._models_py3 import DiskEncryptionSetList - from ._models_py3 import DiskEncryptionSetUpdate - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import Encryption - from ._models_py3 import EncryptionSetIdentity - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import GrantAccessData - from ._models_py3 import ImageDiskReference - from ._models_py3 import InnerError - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import Resource - from ._models_py3 import ShareInfoElement - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - from ._models import ApiError # type: ignore - from ._models import ApiErrorBase # type: ignore - from ._models import CreationData # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskEncryptionSet # type: ignore - from ._models import DiskEncryptionSetList # type: ignore - from ._models import DiskEncryptionSetUpdate # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionSetIdentity # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import ImageDiskReference # type: ignore - from ._models import InnerError # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import Resource # type: ignore - from ._models import ShareInfoElement # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore +from ._models_py3 import AccessUri +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import CreationData +from ._models_py3 import Disk +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import GrantAccessData +from ._models_py3 import ImageDiskReference +from ._models_py3 import InnerError +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import Resource +from ._models_py3 import ShareInfoElement +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_compute_management_client_enums.py index 70451e761e5d..8a8007eef28a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -55,13 +40,13 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the disk. UPLOAD = "Upload" -class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. """ SYSTEM_ASSIGNED = "SystemAssigned" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the disk. """ @@ -78,7 +63,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -93,7 +78,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: databases (for example, SQL, Oracle), and other transaction-heavy workloads. ULTRA_SSD_LRS = "UltraSSD_LRS" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -102,21 +87,21 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Disk is encrypted with Customer managed key at rest. ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY = "EncryptionAtRestWithCustomerKey" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_models.py deleted file mode 100644 index ae18ae5be503..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_models.py +++ /dev/null @@ -1,1136 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -class ApiError(msrest.serialization.Model): - """Api error. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_11_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_11_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2019_11_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the - ImageDiskReference will be the ARM id of the shared galley image version from which to create a - disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'gallery_image_reference': {'key': 'galleryImageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.gallery_image_reference = kwargs.get('gallery_image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the - disk attached. maxShares should be set to a value greater than one for disks to allow attaching - them to multiple VMs. - :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2019_11_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should - be set to a value greater than one for disks to allow attaching them to multiple VMs. - :vartype share_info: list[~azure.mgmt.compute.v2019_11_01.models.ShareInfoElement] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'managed_by_extended': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'share_info': {'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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'managed_by_extended': {'key': 'managedByExtended', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'share_info': {'key': 'properties.shareInfo', 'type': '[ShareInfoElement]'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.managed_by_extended = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.disk_state = None - self.encryption = kwargs.get('encryption', None) - self.max_shares = kwargs.get('max_shares', None) - self.share_info = None - - -class DiskEncryptionSet(Resource): - """disk encryption set resource. - - 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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSetIdentity - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'previous_keys': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyVaultAndKeyReference]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSet, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.active_key = kwargs.get('active_key', None) - self.previous_keys = None - self.provisioning_state = None - - -class DiskEncryptionSetList(msrest.serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskEncryptionSetUpdate(msrest.serialization.Model): - """disk encryption set update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is - used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.active_key = kwargs.get('active_key', None) - - -class DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2019_11_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2019_11_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.max_shares = kwargs.get('max_shares', None) - self.encryption = kwargs.get('encryption', None) - - -class Encryption(msrest.serialization.Model): - """Encryption at rest settings for disk or snapshot. - - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey". - :type type: str or ~azure.mgmt.compute.v2019_11_01.models.EncryptionType - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.type = kwargs.get('type', None) - - -class EncryptionSetIdentity(msrest.serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSetIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2019_11_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', 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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -class ShareInfoElement(msrest.serialization.Model): - """ShareInfoElement. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. - :vartype vm_uri: str - """ - - _validation = { - 'vm_uri': {'readonly': True}, - } - - _attribute_map = { - 'vm_uri': {'key': 'vmUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareInfoElement, self).__init__(**kwargs) - self.vm_uri = None - - -class Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - self.encryption = kwargs.get('encryption', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2019_11_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2019_11_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.encryption = kwargs.get('encryption', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_models_py3.py index 058fd2181067..087181ceb074 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -41,16 +43,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_11_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_11_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2019_11_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2019_11_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -71,6 +73,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2019_11_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2019_11_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -82,12 +96,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -104,6 +118,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -117,31 +139,31 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2019_11_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager + :vartype create_option: str or ~azure.mgmt.compute.v2019_11_01.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype gallery_image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long + :vartype upload_size_bytes: long """ _validation = { @@ -172,6 +194,30 @@ def __init__( upload_size_bytes: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_11_01.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference + :keyword gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :paramtype gallery_image_reference: ~azure.mgmt.compute.v2019_11_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -196,10 +242,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -224,6 +270,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -245,69 +297,69 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :vartype sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long + :vartype disk_m_bps_read_only: long :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2019_11_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype share_info: list[~azure.mgmt.compute.v2019_11_01.models.ShareInfoElement] @@ -377,6 +429,54 @@ def __init__( max_shares: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.managed_by_extended = None @@ -414,15 +514,15 @@ class DiskEncryptionSet(Resource): :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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSetIdentity - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSetIdentity + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference :ivar previous_keys: A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. @@ -461,6 +561,17 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSetIdentity + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.active_key = active_key @@ -473,11 +584,11 @@ class DiskEncryptionSetList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -496,6 +607,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ super(DiskEncryptionSetList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -504,11 +622,11 @@ def __init__( class DiskEncryptionSetUpdate(msrest.serialization.Model): """disk encryption set update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference + :vartype active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -523,6 +641,13 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided + is used to unwrap the encryptionKey. + :paramtype active_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSetUpdate, self).__init__(**kwargs) self.tags = tags self.active_key = active_key @@ -533,11 +658,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2019_11_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2019_11_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -556,6 +681,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2019_11_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -566,9 +698,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2019_11_01.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2019_11_01.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -588,6 +720,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2019_11_01.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -596,42 +733,42 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + :vartype disk_m_bps_read_only: long + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption """ _attribute_map = { @@ -664,6 +801,44 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2019_11_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -681,12 +856,12 @@ def __init__( class Encryption(msrest.serialization.Model): """Encryption at rest settings for disk or snapshot. - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey". - :type type: str or ~azure.mgmt.compute.v2019_11_01.models.EncryptionType + :vartype type: str or ~azure.mgmt.compute.v2019_11_01.models.EncryptionType """ _attribute_map = { @@ -701,6 +876,14 @@ def __init__( type: Optional[Union[str, "EncryptionType"]] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey". + :paramtype type: str or ~azure.mgmt.compute.v2019_11_01.models.EncryptionType + """ super(Encryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id self.type = type @@ -711,9 +894,9 @@ class EncryptionSetIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetIdentityType + :vartype type: str or ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetIdentityType :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity. @@ -741,6 +924,11 @@ def __init__( type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported. Possible values include: "SystemAssigned". + :paramtype type: str or ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetIdentityType + """ super(EncryptionSetIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -752,18 +940,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -784,6 +972,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -793,11 +995,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -812,6 +1014,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2019_11_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -822,10 +1032,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2019_11_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2019_11_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -845,6 +1055,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2019_11_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -855,12 +1071,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -879,6 +1095,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -887,10 +1111,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -905,6 +1129,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -915,10 +1145,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -938,6 +1168,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -948,10 +1184,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -971,6 +1207,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_11_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -997,6 +1239,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareInfoElement, self).__init__(**kwargs) self.vm_uri = None @@ -1014,45 +1258,45 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption """ _validation = { @@ -1103,6 +1347,37 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_11_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2019_11_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -1124,11 +1399,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2019_11_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2019_11_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1147,6 +1422,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2019_11_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1157,9 +1439,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2019_11_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2019_11_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -1179,6 +1461,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2019_11_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1187,24 +1474,24 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption """ _attribute_map = { @@ -1227,6 +1514,26 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2019_11_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_11_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2019_11_01.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2019_11_01.models.Encryption + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1239,8 +1546,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1253,5 +1560,9 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py index 58c10ea69446..007111f67761 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskEncryptionSetsOperations(object): """DiskEncryptionSetsOperations operations. @@ -49,43 +274,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -103,16 +317,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. @@ -126,15 +342,19 @@ def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,27 +366,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,47 +392,37 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -236,16 +440,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. @@ -259,15 +465,19 @@ def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +489,21 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,15 +515,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. @@ -338,27 +543,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,41 +567,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> 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 = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,13 +605,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. @@ -436,15 +623,17 @@ def begin_delete( :type disk_encryption_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -458,21 +647,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -484,21 +666,24 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption 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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -506,35 +691,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,21 +733,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -574,34 +758,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -619,6 +798,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py index 72333f589afd..73c55c9984fb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2019_11_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2019_11_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2019-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_11_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2019-11-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py index bcff06814c28..985f53b5bbd5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2019_11_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2019_11_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2019-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2019_11_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2019-11-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py index 1d157fd8de15..d62a1658959c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py @@ -6,194 +6,170 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -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 UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -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 GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2019_12_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2019_12_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2019_12_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2019_12_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2019_12_01.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2019_12_01.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2019_12_01.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.v2019_12_01.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2019_12_01.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2019_12_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2019_12_01.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2019_12_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2019_12_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2019_12_01.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2019_12_01.operations.VirtualMachineRunCommandsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2019_12_01.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2019_12_01.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2019_12_01.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2019_12_01.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2019_12_01.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2019_12_01.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2019_12_01.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2019_12_01.operations.GalleryApplicationVersionsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.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_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_sets = VirtualMachineScaleSetsOperations( - 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.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.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_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_sets = VirtualMachineScaleSetsOperations(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.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py index cd1d1877ca75..38e6844950d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json index 9b1f5fcf8689..8a6d3ec547b6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py index 9897d9fd35b6..53001d03dc97 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py @@ -6,190 +6,172 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -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 UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -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 GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2019_12_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2019_12_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2019_12_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2019_12_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2019_12_01.aio.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2019_12_01.aio.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2019_12_01.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2019_12_01.aio.operations.DedicatedHostsOperations + :vartype dedicated_hosts: + azure.mgmt.compute.v2019_12_01.aio.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2019_12_01.aio.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2019_12_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2019_12_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2019_12_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2019_12_01.aio.operations.VirtualMachineRunCommandsOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2019_12_01.aio.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2019_12_01.aio.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2019_12_01.aio.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2019_12_01.aio.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2019_12_01.aio.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2019_12_01.aio.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2019_12_01.aio.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2019_12_01.aio.operations.GalleryApplicationVersionsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.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_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_sets = VirtualMachineScaleSetsOperations(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.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(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.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_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_sets = VirtualMachineScaleSetsOperations( - 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.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py index 0fa404f182e5..a8608081381a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py index 784ac9dcf918..8052afa37a51 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2019_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2019_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2019_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py index 9906d861621f..c73f1bf4c927 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -254,27 +240,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -288,8 +264,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -301,8 +280,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -310,35 +291,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -356,11 +333,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -369,8 +348,10 @@ def list_by_subscription( 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.v2019_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -378,34 +359,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -423,6 +399,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py index b88564b19c28..c1104f070349 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -438,7 +417,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -450,30 +430,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -487,8 +456,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -503,8 +475,10 @@ def list_by_host_group( :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.v2019_12_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -512,36 +486,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -559,6 +530,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py index 8e39277e82ee..a797502613b0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._galleries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'Gallery') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,19 @@ async def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2019_12_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore async def _update_initial( @@ -187,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -226,8 +213,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -246,15 +236,19 @@ async def begin_update( :type gallery: ~azure.mgmt.compute.v2019_12_01.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -266,27 +260,21 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -298,8 +286,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -322,27 +312,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -356,8 +336,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -369,27 +351,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -402,6 +374,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -416,15 +390,17 @@ async def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -438,21 +414,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -464,8 +433,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -477,7 +448,8 @@ def list_by_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 GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -485,35 +457,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -531,11 +499,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -544,7 +514,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -552,34 +523,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -597,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py index 8ecee118331e..b1bb31d3ac15 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_application_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_application_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -133,18 +131,24 @@ async def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +162,21 @@ async def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +188,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +205,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -249,8 +236,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -277,18 +267,24 @@ async def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +298,21 @@ async def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +324,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -372,31 +362,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,8 +389,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -425,29 +406,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -460,6 +431,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -483,15 +456,17 @@ async def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -507,23 +482,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -535,8 +501,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, resource_group_name: str, @@ -555,8 +523,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -564,37 +534,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,6 +580,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py index 5927e1f75946..f266243c9941 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -129,15 +127,20 @@ async def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +153,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +179,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore async def _update_initial( @@ -198,33 +195,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -238,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,15 +253,20 @@ async def begin_update( :type gallery_application: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +279,21 @@ async def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,8 +305,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -346,28 +336,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -381,8 +361,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -395,28 +377,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -429,6 +401,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -447,15 +421,17 @@ async def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -470,22 +446,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -497,8 +465,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -513,8 +483,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -522,36 +494,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -569,6 +538,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py index 06f18d2c4e70..f13733497f74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_image_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_image_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -136,15 +134,20 @@ async def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +161,21 @@ async def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +187,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +204,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -249,8 +235,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -280,15 +269,20 @@ async def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +296,21 @@ async def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +322,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -371,31 +359,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,8 +386,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -424,29 +403,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -459,6 +428,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -481,15 +452,17 @@ async def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -505,23 +478,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -533,8 +497,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, resource_group_name: str, @@ -553,8 +519,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -562,37 +530,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py index 9a3aad3181c3..53952314a7aa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -128,15 +126,19 @@ async def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +151,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -182,6 +177,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore async def _update_initial( @@ -197,33 +193,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -237,8 +223,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -262,15 +251,19 @@ async def begin_update( :type gallery_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +276,21 @@ async def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,8 +302,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -344,28 +332,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -379,8 +357,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -393,28 +373,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -427,6 +397,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -445,15 +417,17 @@ async def begin_delete( :type gallery_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -468,22 +442,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -512,7 +480,8 @@ def list_by_gallery( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] @@ -520,36 +489,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -567,6 +533,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py index 2b7ddddb7337..99ce67b98a64 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2019_12_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2019_12_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py index 958c2af0addf..b4d8657cae6f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py index e4aef9fdda3a..8f7b6aa78d45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2019_12_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py index cf9e330cdfaf..489dc1eaa1b1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -256,29 +242,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +267,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,8 +279,10 @@ def list_by_subscription( """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.v2019_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -310,34 +290,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,11 +330,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -370,8 +347,10 @@ def list_by_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.v2019_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -379,35 +358,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,6 +400,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py index d52134185a0a..bed49ab47cfb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._ssh_public_keys_operations import build_create_request, build_delete_request, build_generate_key_pair_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -49,8 +55,10 @@ def list_by_subscription( 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.v2019_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -58,34 +66,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,11 +106,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -119,8 +124,10 @@ def list_by_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 SshPublicKeysGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -128,35 +135,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,11 +177,13 @@ async def get_next(next_link=None): 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 + @distributed_trace_async async def create( self, resource_group_name: str, @@ -204,32 +209,22 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyResource') - # 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') + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,8 +242,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -274,32 +272,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,8 +301,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -337,25 +328,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,6 +351,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -390,27 +375,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +399,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def generate_key_pair( self, resource_group_name: str, @@ -450,27 +428,17 @@ async def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,4 +452,6 @@ async def generate_key_pair( 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/v2019_12_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_usage_operations.py index aef27c762c3a..40ec5d2d89f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2019_12_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py index e682436881e3..f1e76ed124c7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py index b026d92f5c72..30bd01057a8e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2019_12_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_images_operations.py index e164fa6dd1cd..0f2952bb6f30 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py index fff249604651..f5ce93851d4b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -51,8 +57,10 @@ def list( :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.v2019_12_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -133,27 +139,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -167,4 +163,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 436301028c31..4dc54bac5426 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -193,33 +191,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,18 +248,24 @@ async def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,28 +278,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -314,6 +304,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -328,26 +319,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +362,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +387,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,8 +406,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -457,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -494,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -509,8 +482,10 @@ def list( :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.v2019_12_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -518,36 +493,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -565,6 +537,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 8e260a3aa167..27962f35b1bc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index bc9308f1aa77..20c057c70624 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +124,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +151,21 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +177,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +194,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +225,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,18 +251,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,29 +282,21 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -322,6 +308,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -337,29 +324,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -372,6 +349,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +371,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,23 +397,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,8 +416,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -477,31 +451,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -515,8 +478,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -545,30 +511,19 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -582,4 +537,6 @@ async def list( 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/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 71d90ab4e38c..e444817f99d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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.v2019_12_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -546,26 +513,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -578,6 +537,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -595,15 +556,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -618,22 +581,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -645,8 +600,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -663,7 +620,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -675,30 +633,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -712,8 +659,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -739,28 +689,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -774,8 +714,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -801,8 +744,10 @@ def list( '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.v2019_12_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -810,42 +755,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -863,6 +805,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -881,28 +824,19 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -915,6 +849,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -939,15 +875,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -963,22 +901,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -990,6 +920,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1004,26 +935,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1036,6 +959,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1053,15 +978,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1076,22 +1003,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1103,6 +1022,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1117,26 +1037,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1149,6 +1061,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1166,15 +1080,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1189,22 +1105,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1216,6 +1124,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1230,26 +1139,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1262,6 +1163,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1280,15 +1183,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1303,22 +1208,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1330,6 +1227,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1344,26 +1242,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1376,6 +1266,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1394,15 +1286,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1417,22 +1311,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1444,8 +1330,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -1472,26 +1360,18 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1504,6 +1384,7 @@ async def simulate_eviction( 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, @@ -1517,33 +1398,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1559,8 +1430,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1581,15 +1455,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1602,28 +1481,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1635,4 +1507,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py index 67cfd3fde4f5..eba08abcb4e2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_set_orchestration_service_state_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -337,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -351,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -399,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -423,27 +405,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -457,8 +429,10 @@ async def get( 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, @@ -471,33 +445,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,6 +476,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -526,18 +494,22 @@ async def begin_deallocate( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,24 +521,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -578,6 +544,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -592,30 +559,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -628,6 +587,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -642,18 +603,22 @@ async def begin_delete_instances( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -665,24 +630,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -694,8 +653,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -718,27 +679,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -752,8 +703,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -764,8 +718,10 @@ def list( :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.v2019_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -773,35 +729,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -819,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -833,8 +787,10 @@ def list_all( 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.v2019_12_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -842,34 +798,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -887,11 +838,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -906,8 +859,10 @@ def list_skus( :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.v2019_12_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -915,36 +870,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -962,11 +914,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -980,8 +934,10 @@ def get_os_upgrade_history( :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.v2019_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -989,36 +945,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1036,6 +989,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1054,35 +1008,26 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1095,6 +1040,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1116,18 +1063,22 @@ async def begin_power_off( 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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1140,24 +1091,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1169,6 +1114,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1183,33 +1129,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1222,6 +1160,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1236,18 +1176,22 @@ async def begin_restart( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1259,24 +1203,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1288,6 +1226,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1302,33 +1241,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1341,6 +1272,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1355,18 +1288,22 @@ async def begin_start( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1378,24 +1315,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1407,6 +1338,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1421,33 +1353,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1460,6 +1384,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1475,18 +1401,22 @@ async def begin_redeploy( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1498,24 +1428,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1527,6 +1451,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1541,33 +1466,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1580,6 +1497,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1597,18 +1516,22 @@ async def begin_perform_maintenance( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1620,24 +1543,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1649,6 +1566,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1663,30 +1581,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1699,6 +1609,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1713,18 +1625,22 @@ async def begin_update_instances( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,24 +1652,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1765,6 +1675,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1779,33 +1690,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1818,6 +1721,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1834,18 +1739,22 @@ async def begin_reimage( :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.v2019_12_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1857,24 +1766,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1886,6 +1789,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1900,33 +1804,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1939,6 +1835,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1954,18 +1852,22 @@ async def begin_reimage_all( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1977,24 +1879,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2006,8 +1902,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2035,28 +1933,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2070,8 +1958,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2086,7 +1977,8 @@ async def convert_to_single_placement_group( :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.v2019_12_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2019_12_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 @@ -2097,30 +1989,22 @@ async def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2133,6 +2017,7 @@ async def convert_to_single_placement_group( 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, @@ -2145,30 +2030,22 @@ async def _set_orchestration_service_state_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2181,6 +2058,8 @@ async def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace_async async def begin_set_orchestration_service_state( self, resource_group_name: str, @@ -2198,15 +2077,18 @@ async def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2218,24 +2100,18 @@ async def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2247,4 +2123,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py index 9549f6fb9855..39a8ddfc2182 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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.v2019_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py index cd2cc9a8e1ab..f363d43c1cd7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_reapply_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2019_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -315,15 +306,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -367,6 +357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +372,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +405,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -443,15 +427,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,27 +452,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,6 +478,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -508,25 +492,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -539,6 +515,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -553,15 +531,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -575,21 +555,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -601,8 +574,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -616,7 +591,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -628,29 +604,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -664,8 +629,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -688,27 +656,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -722,8 +680,10 @@ async def instance_view( 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, @@ -735,25 +695,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -766,6 +718,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -785,15 +739,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -807,21 +763,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -833,6 +782,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -846,25 +796,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -877,6 +819,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -892,15 +836,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -914,21 +860,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -940,8 +879,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -969,25 +910,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1000,6 +933,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1011,8 +946,10 @@ def list( :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.v2019_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1020,35 +957,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1066,11 +999,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1083,8 +1018,10 @@ def list_all( 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.v2019_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1092,36 +1029,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1139,11 +1071,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1158,8 +1092,10 @@ def list_available_sizes( :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.v2019_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1167,36 +1103,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1214,6 +1147,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1231,27 +1165,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1264,6 +1189,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1284,15 +1211,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,21 +1236,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1333,6 +1255,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1346,27 +1269,17 @@ async def _reapply_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1379,6 +1292,8 @@ async def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace_async async def begin_reapply( self, resource_group_name: str, @@ -1393,15 +1308,17 @@ async def begin_reapply( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1415,21 +1332,14 @@ async def begin_reapply( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1441,6 +1351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1454,25 +1365,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1485,6 +1388,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1499,15 +1404,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1521,21 +1428,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1547,6 +1447,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1560,25 +1461,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1591,6 +1484,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1605,15 +1500,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1627,21 +1524,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1653,6 +1543,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1666,25 +1557,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1697,6 +1580,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1711,15 +1596,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1733,21 +1620,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1759,6 +1639,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1773,33 +1654,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1812,6 +1685,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1829,15 +1704,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1849,24 +1727,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1878,6 +1750,7 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( @@ -1891,25 +1764,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1922,6 +1787,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1937,15 +1804,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1959,21 +1828,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1985,8 +1847,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -2010,25 +1874,17 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2041,6 +1897,7 @@ async def simulate_eviction( simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction'} # type: ignore + async def _run_command_initial( self, resource_group_name: str, @@ -2053,32 +1910,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2094,8 +1941,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -2113,15 +1963,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2133,27 +1988,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2165,4 +2014,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_12_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/__init__.py index cc5ac42515d4..87d536e74827 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/__init__.py @@ -6,444 +6,225 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -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 BillingProfile - from ._models_py3 import BootDiagnostics - from ._models_py3 import BootDiagnosticsInstanceView - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DataDiskImageEncryption - from ._models_py3 import DedicatedHost - from ._models_py3 import DedicatedHostAllocatableVM - from ._models_py3 import DedicatedHostAvailableCapacity - from ._models_py3 import DedicatedHostGroup - from ._models_py3 import DedicatedHostGroupListResult - from ._models_py3 import DedicatedHostGroupUpdate - from ._models_py3 import DedicatedHostInstanceView - from ._models_py3 import DedicatedHostListResult - from ._models_py3 import DedicatedHostUpdate - from ._models_py3 import DiagnosticsProfile - from ._models_py3 import DiffDiskSettings - from ._models_py3 import Disallowed - from ._models_py3 import DiskEncryptionSetParameters - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskImageEncryption - from ._models_py3 import DiskInstanceView - from ._models_py3 import EncryptionImages - from ._models_py3 import Gallery - from ._models_py3 import GalleryApplication - from ._models_py3 import GalleryApplicationList - from ._models_py3 import GalleryApplicationUpdate - from ._models_py3 import GalleryApplicationVersion - from ._models_py3 import GalleryApplicationVersionList - from ._models_py3 import GalleryApplicationVersionPublishingProfile - from ._models_py3 import GalleryApplicationVersionUpdate - from ._models_py3 import GalleryArtifactPublishingProfileBase - from ._models_py3 import GalleryArtifactSource - from ._models_py3 import GalleryArtifactVersionSource - from ._models_py3 import GalleryDataDiskImage - from ._models_py3 import GalleryDiskImage - from ._models_py3 import GalleryIdentifier - from ._models_py3 import GalleryImage - from ._models_py3 import GalleryImageIdentifier - from ._models_py3 import GalleryImageList - from ._models_py3 import GalleryImageUpdate - from ._models_py3 import GalleryImageVersion - from ._models_py3 import GalleryImageVersionList - from ._models_py3 import GalleryImageVersionPublishingProfile - from ._models_py3 import GalleryImageVersionStorageProfile - from ._models_py3 import GalleryImageVersionUpdate - from ._models_py3 import GalleryList - from ._models_py3 import GalleryOSDiskImage - from ._models_py3 import GalleryUpdate - 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 ImagePurchasePlan - from ._models_py3 import ImageReference - from ._models_py3 import ImageStorageProfile - from ._models_py3 import ImageUpdate - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - from ._models_py3 import LogAnalyticsInputBase - from ._models_py3 import LogAnalyticsOperationResult - from ._models_py3 import LogAnalyticsOutput - from ._models_py3 import MaintenanceRedeployStatus - from ._models_py3 import ManagedArtifact - 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 OSDiskImageEncryption - from ._models_py3 import OSProfile - from ._models_py3 import OrchestrationServiceStateInput - from ._models_py3 import OrchestrationServiceSummary - 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 RecommendedMachineConfiguration - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RegionalReplicationStatus - from ._models_py3 import ReplicationStatus - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - from ._models_py3 import ResourceRange - 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 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 StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import SubResourceWithColocationStatus - from ._models_py3 import TargetRegion - from ._models_py3 import TerminateNotificationProfile - from ._models_py3 import ThrottledRequestsInput - from ._models_py3 import UpdateResource - from ._models_py3 import UpdateResourceDefinition - 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 UserArtifactManage - from ._models_py3 import UserArtifactSource - 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 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 VirtualMachineImageResource - from ._models_py3 import VirtualMachineInstanceView - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineReimageParameters - 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 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 VirtualMachineStatusCodeCount - from ._models_py3 import VirtualMachineUpdate - from ._models_py3 import WinRMConfiguration - from ._models_py3 import WinRMListener - from ._models_py3 import WindowsConfiguration -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 BillingProfile # type: ignore - from ._models import BootDiagnostics # type: ignore - from ._models import BootDiagnosticsInstanceView # 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 DataDiskImageEncryption # 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 DedicatedHostGroupListResult # type: ignore - from ._models import DedicatedHostGroupUpdate # type: ignore - from ._models import DedicatedHostInstanceView # 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 Disallowed # type: ignore - from ._models import DiskEncryptionSetParameters # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskImageEncryption # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import EncryptionImages # type: ignore - from ._models import Gallery # type: ignore - from ._models import GalleryApplication # type: ignore - from ._models import GalleryApplicationList # type: ignore - from ._models import GalleryApplicationUpdate # type: ignore - from ._models import GalleryApplicationVersion # type: ignore - from ._models import GalleryApplicationVersionList # type: ignore - from ._models import GalleryApplicationVersionPublishingProfile # type: ignore - from ._models import GalleryApplicationVersionUpdate # type: ignore - from ._models import GalleryArtifactPublishingProfileBase # type: ignore - from ._models import GalleryArtifactSource # type: ignore - from ._models import GalleryArtifactVersionSource # type: ignore - from ._models import GalleryDataDiskImage # type: ignore - from ._models import GalleryDiskImage # type: ignore - from ._models import GalleryIdentifier # type: ignore - from ._models import GalleryImage # type: ignore - from ._models import GalleryImageIdentifier # type: ignore - from ._models import GalleryImageList # type: ignore - from ._models import GalleryImageUpdate # type: ignore - from ._models import GalleryImageVersion # type: ignore - from ._models import GalleryImageVersionList # type: ignore - from ._models import GalleryImageVersionPublishingProfile # type: ignore - from ._models import GalleryImageVersionStorageProfile # type: ignore - from ._models import GalleryImageVersionUpdate # type: ignore - from ._models import GalleryList # type: ignore - from ._models import GalleryOSDiskImage # type: ignore - from ._models import GalleryUpdate # 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 ImagePurchasePlan # 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 InstanceViewStatus # type: ignore - from ._models import KeyVaultKeyReference # type: ignore - from ._models import KeyVaultSecretReference # type: ignore - from ._models import LinuxConfiguration # type: ignore - from ._models import ListUsagesResult # 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 ManagedArtifact # 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 OSDiskImageEncryption # type: ignore - from ._models import OSProfile # type: ignore - from ._models import OrchestrationServiceStateInput # type: ignore - from ._models import OrchestrationServiceSummary # 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 RecommendedMachineConfiguration # type: ignore - from ._models import RecoveryWalkResponse # type: ignore - from ._models import RegionalReplicationStatus # type: ignore - from ._models import ReplicationStatus # type: ignore - from ._models import RequestRateByIntervalInput # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRange # 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 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 StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import SubResourceWithColocationStatus # type: ignore - from ._models import TargetRegion # type: ignore - from ._models import TerminateNotificationProfile # type: ignore - from ._models import ThrottledRequestsInput # type: ignore - from ._models import UpdateResource # type: ignore - from ._models import UpdateResourceDefinition # 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 UserArtifactManage # type: ignore - from ._models import UserArtifactSource # 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 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 VirtualMachineImageResource # type: ignore - from ._models import VirtualMachineInstanceView # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineReimageParameters # 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 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 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_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 BillingProfile +from ._models_py3 import BootDiagnostics +from ._models_py3 import BootDiagnosticsInstanceView +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DataDiskImageEncryption +from ._models_py3 import DedicatedHost +from ._models_py3 import DedicatedHostAllocatableVM +from ._models_py3 import DedicatedHostAvailableCapacity +from ._models_py3 import DedicatedHostGroup +from ._models_py3 import DedicatedHostGroupListResult +from ._models_py3 import DedicatedHostGroupUpdate +from ._models_py3 import DedicatedHostInstanceView +from ._models_py3 import DedicatedHostListResult +from ._models_py3 import DedicatedHostUpdate +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiffDiskSettings +from ._models_py3 import Disallowed +from ._models_py3 import DiskEncryptionSetParameters +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskImageEncryption +from ._models_py3 import DiskInstanceView +from ._models_py3 import EncryptionImages +from ._models_py3 import Gallery +from ._models_py3 import GalleryApplication +from ._models_py3 import GalleryApplicationList +from ._models_py3 import GalleryApplicationUpdate +from ._models_py3 import GalleryApplicationVersion +from ._models_py3 import GalleryApplicationVersionList +from ._models_py3 import GalleryApplicationVersionPublishingProfile +from ._models_py3 import GalleryApplicationVersionUpdate +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryArtifactVersionSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryIdentifier +from ._models_py3 import GalleryImage +from ._models_py3 import GalleryImageIdentifier +from ._models_py3 import GalleryImageList +from ._models_py3 import GalleryImageUpdate +from ._models_py3 import GalleryImageVersion +from ._models_py3 import GalleryImageVersionList +from ._models_py3 import GalleryImageVersionPublishingProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryImageVersionUpdate +from ._models_py3 import GalleryList +from ._models_py3 import GalleryOSDiskImage +from ._models_py3 import GalleryUpdate +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 ImagePurchasePlan +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import ImageUpdate +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +from ._models_py3 import LogAnalyticsInputBase +from ._models_py3 import LogAnalyticsOperationResult +from ._models_py3 import LogAnalyticsOutput +from ._models_py3 import MaintenanceRedeployStatus +from ._models_py3 import ManagedArtifact +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 OSDiskImageEncryption +from ._models_py3 import OSProfile +from ._models_py3 import OrchestrationServiceStateInput +from ._models_py3 import OrchestrationServiceSummary +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 RecommendedMachineConfiguration +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RegionalReplicationStatus +from ._models_py3 import ReplicationStatus +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceRange +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 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 StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import SubResourceWithColocationStatus +from ._models_py3 import TargetRegion +from ._models_py3 import TerminateNotificationProfile +from ._models_py3 import ThrottledRequestsInput +from ._models_py3 import UpdateResource +from ._models_py3 import UpdateResourceDefinition +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 UserArtifactManage +from ._models_py3 import UserArtifactSource +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 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 VirtualMachineImageResource +from ._models_py3 import VirtualMachineInstanceView +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineReimageParameters +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 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 VirtualMachineStatusCodeCount +from ._models_py3 import VirtualMachineUpdate +from ._models_py3 import WinRMConfiguration +from ._models_py3 import WinRMListener +from ._models_py3 import WindowsConfiguration + from ._compute_management_client_enums import ( AggregatedReplicationState, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py index 9119a47b155d..9d130ec26227 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the aggregated replication status based on all the regional replication status flags. """ @@ -35,7 +20,7 @@ class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, E COMPLETED = "Completed" FAILED = "Failed" -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -43,7 +28,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -54,7 +39,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -65,13 +50,13 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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 @@ -84,7 +69,7 @@ class DiffDiskPlacement(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CACHE_DISK = "CacheDisk" RESOURCE_DISK = "ResourceDisk" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -97,7 +82,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -108,7 +93,7 @@ class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseI DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImagePropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -119,7 +104,7 @@ class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImageVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -130,7 +115,7 @@ class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensi DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -141,7 +126,7 @@ class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta DELETING = "Deleting" MIGRATING = "Migrating" -class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' """ @@ -149,28 +134,28 @@ class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -179,7 +164,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -188,7 +173,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -197,7 +182,7 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -206,21 +191,21 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class OrchestrationServiceNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. """ @@ -228,14 +213,14 @@ class OrchestrationServiceState(with_metaclass(_CaseInsensitiveEnumMeta, str, En RUNNING = "Running" SUSPENDED = "Suspended" -class OrchestrationServiceStateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrchestrationServiceStateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action to be performed. """ RESUME = "Resume" SUSPEND = "Suspend" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -243,7 +228,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -252,7 +237,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the regional replication state. """ @@ -261,11 +246,11 @@ class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAILED = "Failed" -class ReplicationStatusTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationStatusTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REPLICATION_STATUS = "ReplicationStatus" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -276,14 +261,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -292,7 +277,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -300,7 +285,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -308,7 +293,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type to be used to store the image. This property is not updatable. """ @@ -317,7 +302,7 @@ class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. @@ -332,7 +317,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -344,7 +329,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -352,7 +337,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -361,14 +346,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -378,20 +363,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models.py deleted file mode 100644 index 78da23f52f11..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models.py +++ /dev/null @@ -1,8916 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2019_12_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_12_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_12_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2019_12_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2019_12_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, - **kwargs - ): - 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 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, - **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. - :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. - :vartype console_screenshot_blob_uri: str - :ivar serial_console_log_blob_uri: The Linux serial console log blob Uri. - :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.v2019_12_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 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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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 DiskImageEncryption(msrest.serialization.Model): - """This is the disk image encryption base class. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskImageEncryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class DataDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for a data disk image. - - All required parameters must be populated in order to send to Azure. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - :param lun: Required. This property specifies the logical unit number of the data disk. This - value is used to identify data disks within the Virtual Machine and therefore must be unique - for each data disk attached to the Virtual Machine. - :type lun: int - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDiskImageEncryption, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.DedicatedHostInstanceView - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'platform_fault_domain': {'maximum': 2, '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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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.v2019_12_01.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, - } - - def __init__( - self, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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.v2019_12_01.models.SubResourceReadOnly] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'platform_fault_domain_count': {'maximum': 3, 'minimum': 1}, - 'hosts': {'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]'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2019_12_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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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.v2019_12_01.models.SubResourceReadOnly] - """ - - _validation = { - 'platform_fault_domain_count': {'maximum': 3, 'minimum': 1}, - 'hosts': {'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]'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2019_12_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', 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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.DedicatedHostInstanceView - """ - - _validation = { - 'platform_fault_domain': {'maximum': 2, '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.v2019_12_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.v2019_12_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.v2019_12_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 Disallowed(msrest.serialization.Model): - """Describes the disallowed disk types. - - :param disk_types: A list of disk types. - :type disk_types: list[str] - """ - - _attribute_map = { - 'disk_types': {'key': 'diskTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Disallowed, self).__init__(**kwargs) - self.disk_types = kwargs.get('disk_types', 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.v2019_12_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.v2019_12_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.v2019_12_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_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 EncryptionImages(msrest.serialization.Model): - """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. - - :param os_disk_image: Contains encryption settings for an OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImageEncryption - :param data_disk_images: A list of encryption specifications for data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImageEncryption] - """ - - _attribute_map = { - 'os_disk_image': {'key': 'osDiskImage', 'type': 'OSDiskImageEncryption'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[DataDiskImageEncryption]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionImages, self).__init__(**kwargs) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', None) - - -class Gallery(Resource): - """Specifies information about the Shared Image Gallery that you want to create or update. - - 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 description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryPropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Gallery, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - - -class GalleryApplication(Resource): - """Specifies information about the gallery Application Definition that you want to create or update. - - 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 description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplication, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationList(msrest.serialization.Model): - """The List Gallery Applications operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application - Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class UpdateResourceDefinition(msrest.serialization.Model): - """The Update Resource model definition. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateResourceDefinition, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - - -class GalleryApplicationUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Definition that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationVersion(Resource): - """Specifies information about the gallery Application Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_12_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryApplicationVersionList(msrest.serialization.Model): - """The List Gallery Application version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call - ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplicationVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): - """Describes the basic gallery artifact publishing profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) - self.target_regions = kwargs.get('target_regions', None) - self.replica_count = kwargs.get('replica_count', None) - self.exclude_from_latest = kwargs.get('exclude_from_latest', None) - self.published_date = None - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - - -class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image version. - - 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 target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool - """ - - _validation = { - 'published_date': {'readonly': True}, - 'source': {'required': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, - 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) - self.source = kwargs['source'] - self.manage_actions = kwargs.get('manage_actions', None) - self.enable_health_check = kwargs.get('enable_health_check', None) - - -class GalleryApplicationVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Version that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_12_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2019_12_01.models.ManagedArtifact - """ - - _validation = { - 'managed_image': {'required': True}, - } - - _attribute_map = { - 'managed_image': {'key': 'managedImage', 'type': 'ManagedArtifact'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactSource, self).__init__(**kwargs) - self.managed_image = kwargs['managed_image'] - - -class GalleryArtifactVersionSource(msrest.serialization.Model): - """The gallery artifact version source. - - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, - or user image. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactVersionSource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class GalleryDiskImage(msrest.serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDiskImage, self).__init__(**kwargs) - self.size_in_gb = None - self.host_caching = kwargs.get('host_caching', None) - self.source = kwargs.get('source', None) - - -class GalleryDataDiskImage(GalleryDiskImage): - """This is the data disk 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 size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This - value is used to identify data disks within the Virtual Machine and therefore must be unique - for each data disk attached to the Virtual Machine. - :type lun: int - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'lun': {'required': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDataDiskImage, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -class GalleryIdentifier(msrest.serialization.Model): - """Describes the gallery unique name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated - automatically by Azure. - :vartype unique_name: str - """ - - _validation = { - 'unique_name': {'readonly': True}, - } - - _attribute_map = { - 'unique_name': {'key': 'uniqueName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryIdentifier, self).__init__(**kwargs) - self.unique_name = None - - -class GalleryImage(Resource): - """Specifies information about the gallery Image Definition that you want to create or update. - - 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 description: The description of this gallery Image Definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2019_12_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryImagePropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImage, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageIdentifier(msrest.serialization.Model): - """This is the gallery Image Definition identifier. - - All required parameters must be populated in order to send to Azure. - - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str - """ - - _validation = { - 'publisher': {'required': True}, - 'offer': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageIdentifier, self).__init__(**kwargs) - self.publisher = kwargs['publisher'] - self.offer = kwargs['offer'] - self.sku = kwargs['sku'] - - -class GalleryImageList(msrest.serialization.Model): - """The List Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Image Definition that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Image Definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2019_12_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryImagePropertiesProvisioningState - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageVersion(Resource): - """Specifies information about the gallery Image Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_12_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryImageVersionList(msrest.serialization.Model): - """The List Gallery Image version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery Image Version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionPublishingProfile, self).__init__(**kwargs) - - -class GalleryImageVersionStorageProfile(msrest.serialization.Model): - """This is the storage profile of a Gallery Image Version. - - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.GalleryDataDiskImage] - """ - - _attribute_map = { - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'os_disk_image': {'key': 'osDiskImage', 'type': 'GalleryOSDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[GalleryDataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', None) - - -class GalleryImageVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Image Version that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery Image Version. - :vartype replication_status: ~azure.mgmt.compute.v2019_12_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryList(msrest.serialization.Model): - """The List Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Gallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryOSDiskImage, self).__init__(**kwargs) - - -class GalleryUpdate(UpdateResourceDefinition): - """Specifies information about the Shared Image Gallery that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2019_12_01.models.GalleryPropertiesProvisioningState - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - - -class HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. - :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a - list of available sizes use 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 - `_. 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.v2019_12_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_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}'}, - '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.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.v2019_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_12_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.v2019_12_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_12_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.v2019_12_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_12_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.v2019_12_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_12_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 ImagePurchasePlan(msrest.serialization.Model): - """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImagePurchasePlan, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.publisher = kwargs.get('publisher', None) - self.product = kwargs.get('product', None) - - -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.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_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 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.v2019_12_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 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.v2019_12_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.v2019_12_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 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.v2019_12_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 - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, - } - - 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) - - -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.v2019_12_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 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 - """ - - _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'}, - } - - 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) - - -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.v2019_12_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.v2019_12_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 ManagedArtifact(msrest.serialization.Model): - """The managed artifact. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The managed artifact id. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedArtifact, self).__init__(**kwargs) - self.id = kwargs['id'] - - -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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", - "Suspend". - :type action: str or ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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 OSDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for an OS disk image. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OSDiskImageEncryption, self).__init__(**kwargs) - - -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.v2019_12_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.v2019_12_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2019_12_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. - :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 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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2019_12_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.v2019_12_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 RecommendedMachineConfiguration(msrest.serialization.Model): - """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange - """ - - _attribute_map = { - 'v_cp_us': {'key': 'vCPUs', 'type': 'ResourceRange'}, - 'memory': {'key': 'memory', 'type': 'ResourceRange'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedMachineConfiguration, self).__init__(**kwargs) - self.v_cp_us = kwargs.get('v_cp_us', None) - self.memory = kwargs.get('memory', None) - - -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 RegionalReplicationStatus(msrest.serialization.Model): - """This is the regional replication status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: The region to which the gallery Image Version is being replicated to. - :vartype region: str - :ivar state: This is the regional replication state. Possible values include: "Unknown", - "Replicating", "Completed", "Failed". - :vartype state: str or ~azure.mgmt.compute.v2019_12_01.models.ReplicationState - :ivar details: The details of the replication status. - :vartype details: str - :ivar progress: It indicates progress of the replication job. - :vartype progress: int - """ - - _validation = { - 'region': {'readonly': True}, - 'state': {'readonly': True}, - 'details': {'readonly': True}, - 'progress': {'readonly': True}, - } - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalReplicationStatus, self).__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None - - -class ReplicationStatus(msrest.serialization.Model): - """This is the replication status of the gallery Image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: This is the aggregated replication status based on all the regional - replication status flags. Possible values include: "Unknown", "InProgress", "Completed", - "Failed". - :vartype aggregated_state: str or - ~azure.mgmt.compute.v2019_12_01.models.AggregatedReplicationState - :ivar summary: This is a summary of replication status for each region. - :vartype summary: list[~azure.mgmt.compute.v2019_12_01.models.RegionalReplicationStatus] - """ - - _validation = { - 'aggregated_state': {'readonly': True}, - 'summary': {'readonly': True}, - } - - _attribute_map = { - 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': '[RegionalReplicationStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationStatus, self).__init__(**kwargs) - self.aggregated_state = None - self.summary = 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 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.v2019_12_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'}, - 'interval_length': {'key': 'intervalLength', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RequestRateByIntervalInput, self).__init__(**kwargs) - self.interval_length = kwargs['interval_length'] - - -class ResourceRange(msrest.serialization.Model): - """Describes the resource range. - - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int - """ - - _attribute_map = { - 'min': {'key': 'min', 'type': 'int'}, - 'max': {'key': 'max', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRange, self).__init__(**kwargs) - self.min = kwargs.get('min', None) - self.max = kwargs.get('max', 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.v2019_12_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 - """ - - _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'}, - } - - 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) - - -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.v2019_12_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.v2019_12_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.v2019_12_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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 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.v2019_12_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.v2019_12_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 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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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 TargetRegion(msrest.serialization.Model): - """Describes the target region information. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType - :param encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :type encryption: ~azure.mgmt.compute.v2019_12_01.models.EncryptionImages - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'regional_replica_count': {'key': 'regionalReplicaCount', 'type': 'int'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'EncryptionImages'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetRegion, self).__init__(**kwargs) - self.name = kwargs['name'] - self.regional_replica_count = kwargs.get('regional_replica_count', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - self.encryption = kwargs.get('encryption', 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ThrottledRequestsInput, self).__init__(**kwargs) - - -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.v2019_12_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.v2019_12_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2019_12_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type automatic_os_upgrade_policy: - ~azure.mgmt.compute.v2019_12_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: An enum describing the unit of usage measurement. Has constant 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.v2019_12_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 UserArtifactManage(msrest.serialization.Model): - """UserArtifactManage. - - All required parameters must be populated in order to send to Azure. - - :param install: Required. Required. The path and arguments to install the gallery application. - This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. - This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not - present, then update operation will invoke remove command on the previous version and install - command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str - """ - - _validation = { - 'install': {'required': True}, - 'remove': {'required': True}, - } - - _attribute_map = { - 'install': {'key': 'install', 'type': 'str'}, - 'remove': {'key': 'remove', 'type': 'str'}, - 'update': {'key': 'update', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactManage, self).__init__(**kwargs) - self.install = kwargs['install'] - self.remove = kwargs['remove'] - self.update = kwargs.get('update', None) - - -class UserArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must - be a readable storage page blob. - :type default_configuration_link: str - """ - - _validation = { - 'media_link': {'required': True}, - } - - _attribute_map = { - 'media_link': {'key': 'mediaLink', 'type': 'str'}, - 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactSource, self).__init__(**kwargs) - self.media_link = kwargs['media_link'] - self.default_configuration_link = kwargs.get('default_configuration_link', 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.v2019_12_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _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]'}, - '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'}, - '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'}, - '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'}, - } - - 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.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.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.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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.v2019_12_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_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 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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2019_12_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'}, - '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.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.v2019_12_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.v2019_12_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_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.v2019_12_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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'}, - '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.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.v2019_12_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.v2019_12_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.v2019_12_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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2019_12_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: - ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.HyperVGenerationTypes - """ - - _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}'}, - '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'}, - } - - 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) - - -class VirtualMachineInstanceView(msrest.serialization.Model): - """The instance view of a virtual machine. - - :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.v2019_12_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.v2019_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2019_12_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView] - :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.v2019_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] - """ - - _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]'}, - 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - 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.boot_diagnostics = kwargs.get('boot_diagnostics', None) - self.statuses = kwargs.get('statuses', 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.v2019_12_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 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 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.v2019_12_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.v2019_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.ScaleInPolicy - """ - - _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]'}, - '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'}, - 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, - 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, - } - - 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.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.additional_capabilities = kwargs.get('additional_capabilities', None) - self.scale_in_policy = kwargs.get('scale_in_policy', 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.v2019_12_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.v2019_12_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.v2019_12_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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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'}, - '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.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.v2019_12_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.v2019_12_01.models.VirtualMachineScaleSetExtension] - """ - - _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('extensions', 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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'}, - '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.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.v2019_12_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.v2019_12_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.v2019_12_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] - :ivar orchestration_services: The orchestration services information. - :vartype orchestration_services: - list[~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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. 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. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_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.v2019_12_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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2019_12_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'}, - '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.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.v2019_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2019_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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 network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2019_12_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'}, - '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.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.v2019_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, - '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'}, - } - - 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.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) - - -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.v2019_12_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.v2019_12_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: - ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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.v2019_12_01.models.VirtualMachineScaleSetVMProtectionPolicy - """ - - _validation = { - '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 = { - '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'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.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) - - -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.v2019_12_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 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2019_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2019_12_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] - :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 = { - 'vm_health': {'readonly': True}, - } - - _attribute_map = { - '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]'}, - 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.placement_group_id = kwargs.get('placement_group_id', None) - - -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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2019_12_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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.v2019_12_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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.v2019_12_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.v2019_12_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.v2019_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile - """ - - _attribute_map = { - 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, - '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'}, - } - - 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.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) - - -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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2019_12_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. - :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_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.v2019_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed - on-premises. This element is only used for images that contain the Windows Server operating - system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client - :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in - a request for an update, the value must match the initial value. This value cannot be updated. - :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - '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'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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.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.provisioning_state = None - self.instance_view = None - self.license_type = kwargs.get('license_type', None) - self.vm_id = 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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': '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.v2019_12_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2019_12_01.models.WinRMConfiguration - """ - - _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]'}, - '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.win_rm = kwargs.get('win_rm', None) - - -class WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2019_12_01.models.WinRMListener] - """ - - _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.v2019_12_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2019_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py index b25418d57c72..1dd9bf0e5069 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py @@ -17,11 +17,11 @@ 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -34,6 +34,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -41,21 +48,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2019_12_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2019_12_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -74,6 +81,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2019_12_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -84,9 +108,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -99,6 +123,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -106,16 +135,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2019_12_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2019_12_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2019_12_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2019_12_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -136,6 +165,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2019_12_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2019_12_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -147,12 +188,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -169,6 +210,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -178,16 +227,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -202,6 +251,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -212,9 +273,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -231,6 +292,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -238,15 +304,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -261,6 +327,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -279,10 +356,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -307,6 +384,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -328,25 +411,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_12_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.v2019_12_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: + :vartype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :ivar 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.v2019_12_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ @@ -385,6 +468,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -399,11 +504,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -422,6 +527,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -430,8 +542,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -444,6 +556,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -453,20 +569,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2019_12_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.v2019_12_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :ivar 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.v2019_12_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ @@ -496,6 +612,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -508,7 +641,7 @@ def __init__( 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. + :ivar 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 @@ -520,7 +653,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -533,6 +666,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -540,11 +688,11 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and screenshot. - :type storage_uri: str + :vartype storage_uri: str """ _attribute_map = { @@ -559,6 +707,13 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -594,6 +749,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -621,6 +778,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -666,6 +825,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -682,44 +843,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2019_12_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :ivar 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.v2019_12_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :ivar 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.v2019_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :ivar 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.v2019_12_01.models.ManagedDiskParameters - :param to_be_detached: Specifies whether the data disk is in process of detachment from the + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype 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. @@ -767,6 +928,46 @@ def __init__( to_be_detached: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -804,6 +1005,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -811,9 +1014,9 @@ def __init__( class DiskImageEncryption(msrest.serialization.Model): """This is the disk image encryption base class. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str + :vartype disk_encryption_set_id: str """ _attribute_map = { @@ -826,6 +1029,11 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ super(DiskImageEncryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id @@ -835,13 +1043,13 @@ class DataDiskImageEncryption(DiskImageEncryption): All required parameters must be populated in order to send to Azure. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str - :param lun: Required. This property specifies the logical unit number of the data disk. This + :vartype disk_encryption_set_id: str + :ivar lun: Required. This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - :type lun: int + :vartype lun: int """ _validation = { @@ -860,6 +1068,15 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ super(DataDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) self.lun = lun @@ -877,29 +1094,29 @@ class DedicatedHost(Resource): :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.v2019_12_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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2019_12_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2019_12_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2019_12_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. @@ -950,6 +1167,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2019_12_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -965,11 +1204,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -984,6 +1223,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -992,9 +1238,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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.v2019_12_01.models.DedicatedHostAllocatableVM] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1007,6 +1254,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1024,16 +1277,16 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2019_12_01.models.SubResourceReadOnly] """ @@ -1067,6 +1320,18 @@ def __init__( platform_fault_domain_count: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1078,11 +1343,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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.v2019_12_01.models.DedicatedHostGroup] - :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1101,6 +1366,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1111,14 +1383,14 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2019_12_01.models.SubResourceReadOnly] """ @@ -1143,6 +1415,16 @@ def __init__( platform_fault_domain_count: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1157,10 +1439,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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.v2019_12_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2019_12_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ _validation = { @@ -1180,6 +1463,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2019_12_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -1191,11 +1481,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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.v2019_12_01.models.DedicatedHost] - :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1214,6 +1504,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1224,24 +1521,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2019_12_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2019_12_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2019_12_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. @@ -1280,6 +1577,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2019_12_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -1294,11 +1608,11 @@ def __init__( 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 + :ivar 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.v2019_12_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_12_01.models.BootDiagnostics """ _attribute_map = { @@ -1311,6 +1625,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_12_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -1318,10 +1639,10 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2019_12_01.models.DiffDiskOptions - :param placement: Specifies the ephemeral disk placement for operating system + :vartype option: str or ~azure.mgmt.compute.v2019_12_01.models.DiffDiskOptions + :ivar 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:`
    ` @@ -1329,7 +1650,7 @@ class DiffDiskSettings(msrest.serialization.Model): 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.v2019_12_01.models.DiffDiskPlacement + :vartype placement: str or ~azure.mgmt.compute.v2019_12_01.models.DiffDiskPlacement """ _attribute_map = { @@ -1344,6 +1665,20 @@ def __init__( placement: Optional[Union[str, "DiffDiskPlacement"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2019_12_01.models.DiffDiskOptions + :keyword 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". + :paramtype placement: str or ~azure.mgmt.compute.v2019_12_01.models.DiffDiskPlacement + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option self.placement = placement @@ -1352,8 +1687,8 @@ def __init__( class Disallowed(msrest.serialization.Model): """Describes the disallowed disk types. - :param disk_types: A list of disk types. - :type disk_types: list[str] + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] """ _attribute_map = { @@ -1366,6 +1701,10 @@ def __init__( disk_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ super(Disallowed, self).__init__(**kwargs) self.disk_types = disk_types @@ -1373,8 +1712,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1387,6 +1726,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1394,8 +1737,8 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1408,19 +1751,23 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2019_12_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2019_12_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -1437,6 +1784,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2019_12_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2019_12_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -1446,13 +1802,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2019_12_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -1469,6 +1826,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -1478,10 +1845,10 @@ def __init__( class EncryptionImages(msrest.serialization.Model): """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. - :param os_disk_image: Contains encryption settings for an OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImageEncryption - :param data_disk_images: A list of encryption specifications for data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImageEncryption] + :ivar os_disk_image: Contains encryption settings for an OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImageEncryption + :ivar data_disk_images: A list of encryption specifications for data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImageEncryption] """ _attribute_map = { @@ -1496,6 +1863,13 @@ def __init__( data_disk_images: Optional[List["DataDiskImageEncryption"]] = None, **kwargs ): + """ + :keyword os_disk_image: Contains encryption settings for an OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImageEncryption + :keyword data_disk_images: A list of encryption specifications for data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImageEncryption] + """ super(EncryptionImages, self).__init__(**kwargs) self.os_disk_image = os_disk_image self.data_disk_images = data_disk_images @@ -1514,15 +1888,15 @@ class Gallery(Resource): :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 description: The description of this Shared Image Gallery resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -1557,6 +1931,17 @@ def __init__( identifier: Optional["GalleryIdentifier"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier + """ super(Gallery, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -1576,27 +1961,27 @@ class GalleryApplication(Resource): :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 description: The description of this gallery Application Definition resource. This + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes """ _validation = { @@ -1633,6 +2018,30 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + """ super(GalleryApplication, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -1647,11 +2056,11 @@ class GalleryApplicationList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application + :ivar value: Required. A list of Gallery Applications. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] + :ivar next_link: The uri to fetch the next page of Application Definitions in the Application Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1670,6 +2079,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Gallery Applications. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] + :keyword next_link: The uri to fetch the next page of Application Definitions in the + Application Gallery. Call ListNext() with this to fetch the next page of gallery Application + Definitions. + :paramtype next_link: str + """ super(GalleryApplicationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1686,8 +2103,8 @@ class UpdateResourceDefinition(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -1709,6 +2126,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResourceDefinition, self).__init__(**kwargs) self.id = None self.name = None @@ -1727,25 +2148,25 @@ class GalleryApplicationUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes """ _validation = { @@ -1779,6 +2200,28 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + """ super(GalleryApplicationUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -1801,12 +2244,12 @@ class GalleryApplicationVersion(Resource): :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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -1844,6 +2287,15 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -1855,11 +2307,11 @@ class GalleryApplicationVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call + :ivar value: Required. A list of gallery Application Versions. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] + :ivar next_link: The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1878,6 +2330,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Application Versions. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] + :keyword next_link: The uri to fetch the next page of gallery Application Versions. Call + ListNext() with this to fetch the next page of gallery Application Versions. + :paramtype next_link: str + """ super(GalleryApplicationVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1888,25 +2347,25 @@ class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType """ _validation = { @@ -1932,6 +2391,26 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + """ super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) self.target_regions = target_regions self.replica_count = replica_count @@ -1948,31 +2427,31 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactManage + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool """ _validation = { @@ -2005,6 +2484,33 @@ def __init__( enable_health_check: Optional[bool] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactSource + :keyword manage_actions: + :paramtype manage_actions: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactManage + :keyword enable_health_check: Optional. Whether or not this application reports health. + :paramtype enable_health_check: bool + """ super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source self.manage_actions = manage_actions @@ -2022,10 +2528,10 @@ class GalleryApplicationVersionUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -2060,6 +2566,13 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2071,8 +2584,8 @@ class GalleryArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2019_12_01.models.ManagedArtifact + :ivar managed_image: Required. The managed artifact. + :vartype managed_image: ~azure.mgmt.compute.v2019_12_01.models.ManagedArtifact """ _validation = { @@ -2089,6 +2602,10 @@ def __init__( managed_image: "ManagedArtifact", **kwargs ): + """ + :keyword managed_image: Required. The managed artifact. + :paramtype managed_image: ~azure.mgmt.compute.v2019_12_01.models.ManagedArtifact + """ super(GalleryArtifactSource, self).__init__(**kwargs) self.managed_image = managed_image @@ -2096,9 +2613,9 @@ def __init__( class GalleryArtifactVersionSource(msrest.serialization.Model): """The gallery artifact version source. - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, + :ivar id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, or user image. - :type id: str + :vartype id: str """ _attribute_map = { @@ -2111,6 +2628,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The id of the gallery artifact version source. Can specify a disk uri, snapshot + uri, or user image. + :paramtype id: str + """ super(GalleryArtifactVersionSource, self).__init__(**kwargs) self.id = id @@ -2122,11 +2644,11 @@ class GalleryDiskImage(msrest.serialization.Model): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource """ _validation = { @@ -2146,6 +2668,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + """ super(GalleryDiskImage, self).__init__(**kwargs) self.size_in_gb = None self.host_caching = host_caching @@ -2161,15 +2690,15 @@ class GalleryDataDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This + :vartype host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + :ivar lun: Required. This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - :type lun: int + :vartype lun: int """ _validation = { @@ -2192,6 +2721,17 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ super(GalleryDataDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) self.lun = lun @@ -2218,6 +2758,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryIdentifier, self).__init__(**kwargs) self.unique_name = None @@ -2235,44 +2777,44 @@ class GalleryImage(Resource): :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 description: The description of this gallery Image Definition resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Image Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery Image Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2019_12_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery Image Definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery Image Definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed + :ivar purchase_plan: Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2327,6 +2869,46 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Image Definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Image Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery Image Definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery Image Definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed + :keyword purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan + """ super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -2348,12 +2930,12 @@ class GalleryImageIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param publisher: Required. The name of the gallery Image Definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery Image Definition offer. - :type offer: str - :param sku: Required. The name of the gallery Image Definition SKU. - :type sku: str + :ivar publisher: Required. The name of the gallery Image Definition publisher. + :vartype publisher: str + :ivar offer: Required. The name of the gallery Image Definition offer. + :vartype offer: str + :ivar sku: Required. The name of the gallery Image Definition SKU. + :vartype sku: str """ _validation = { @@ -2376,6 +2958,14 @@ def __init__( sku: str, **kwargs ): + """ + :keyword publisher: Required. The name of the gallery Image Definition publisher. + :paramtype publisher: str + :keyword offer: Required. The name of the gallery Image Definition offer. + :paramtype offer: str + :keyword sku: Required. The name of the gallery Image Definition SKU. + :paramtype sku: str + """ super(GalleryImageIdentifier, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -2387,11 +2977,11 @@ class GalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image + :ivar value: Required. A list of Shared Image Gallery images. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] + :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2410,6 +3000,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Shared Image Gallery images. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] + :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. + :paramtype next_link: str + """ super(GalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2426,42 +3023,42 @@ class GalleryImageUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Image Definition resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Image Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Image Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery Image Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2019_12_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery Image Definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery Image Definition identifier. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed - :param purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery Image Definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery Image Definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed + :ivar purchase_plan: Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2513,6 +3110,44 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Image Definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Image Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery Image Definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery Image Definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2019_12_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2019_12_01.models.Disallowed + :keyword purchase_plan: Describes the gallery Image Definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2019_12_01.models.ImagePurchasePlan + """ super(GalleryImageUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -2542,19 +3177,20 @@ class GalleryImageVersion(Resource): :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 publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery Image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery Image Version. :vartype replication_status: ~azure.mgmt.compute.v2019_12_01.models.ReplicationStatus """ @@ -2589,6 +3225,18 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery Image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2601,11 +3249,11 @@ class GalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Image Versions. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() - with this to fetch the next page of gallery Image Versions. - :type next_link: str + :ivar value: Required. A list of gallery Image Versions. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] + :ivar next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() with + this to fetch the next page of gallery Image Versions. + :vartype next_link: str """ _validation = { @@ -2624,6 +3272,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Image Versions. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] + :keyword next_link: The uri to fetch the next page of gallery Image Versions. Call ListNext() + with this to fetch the next page of gallery Image Versions. + :paramtype next_link: str + """ super(GalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2634,25 +3289,25 @@ class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase) Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery Image Version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery Image Version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery Image Version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType """ _validation = { @@ -2678,18 +3333,38 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2019_12_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery Image Version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + """ super(GalleryImageVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) class GalleryImageVersionStorageProfile(msrest.serialization.Model): """This is the storage profile of a Gallery Image Version. - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.GalleryDataDiskImage] + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.GalleryDataDiskImage] """ _attribute_map = { @@ -2706,6 +3381,14 @@ def __init__( data_disk_images: Optional[List["GalleryDataDiskImage"]] = None, **kwargs ): + """ + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.GalleryDataDiskImage] + """ super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) self.source = source self.os_disk_image = os_disk_image @@ -2723,17 +3406,18 @@ class GalleryImageVersionUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery Image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery Image Version. :vartype replication_status: ~azure.mgmt.compute.v2019_12_01.models.ReplicationStatus """ @@ -2765,6 +3449,16 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery Image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2777,11 +3471,11 @@ class GalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + :ivar value: Required. A list of galleries. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.Gallery] + :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2800,6 +3494,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of galleries. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.Gallery] + :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :paramtype next_link: str + """ super(GalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2812,11 +3513,11 @@ class GalleryOSDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource """ _validation = { @@ -2836,6 +3537,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2019_12_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource + """ super(GalleryOSDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) @@ -2850,13 +3558,13 @@ class GalleryUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this Shared Image Gallery resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2888,6 +3596,15 @@ def __init__( identifier: Optional["GalleryIdentifier"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2019_12_01.models.GalleryIdentifier + """ super(GalleryUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -2897,7 +3614,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a @@ -2943,7 +3660,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2019_12_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -2956,6 +3673,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. + :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a + list of available sizes use 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 + `_. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -2973,19 +3739,20 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes """ _validation = { @@ -3018,6 +3785,20 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -3028,29 +3809,31 @@ def __init__( class ImageDisk(msrest.serialization.Model): """Describes a image disk. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -3075,6 +3858,33 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + """ super(ImageDisk, self).__init__(**kwargs) self.snapshot = snapshot self.managed_disk = managed_disk @@ -3090,33 +3900,35 @@ class ImageDataDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters - :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype lun: int """ _validation = { @@ -3147,6 +3959,37 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + :keyword 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. + :paramtype lun: int + """ 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 @@ -3156,11 +3999,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2019_12_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3179,6 +4022,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3189,36 +4039,38 @@ class ImageOSDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2019_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters - :param os_type: Required. This property allows you to specify the type of the OS that is + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + :ivar 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.v2019_12_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes + :vartype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes """ _validation = { @@ -3252,6 +4104,41 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemStateTypes + """ 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 @@ -3260,12 +4147,12 @@ def __init__( class ImagePurchasePlan(msrest.serialization.Model): """Describes the gallery Image Definition purchase plan. This is used by marketplace images. - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str """ _attribute_map = { @@ -3282,6 +4169,14 @@ def __init__( product: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product ID. + :paramtype product: str + """ super(ImagePurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3293,21 +4188,21 @@ class ImageReference(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype 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'. @@ -3337,6 +4232,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -3348,19 +4260,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2019_12_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_12_01.models.ImageOSDisk + :ivar 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.v2019_12_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -3377,6 +4289,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_12_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -3388,17 +4315,18 @@ class ImageUpdate(UpdateResource): 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.v2019_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes """ _validation = { @@ -3422,6 +4350,18 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -3432,10 +4372,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -3450,6 +4390,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -3458,16 +4404,16 @@ def __init__( 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.v2019_12_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2019_12_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -3488,6 +4434,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2019_12_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -3501,10 +4459,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2019_12_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2019_12_01.models.SubResource """ _validation = { @@ -3524,6 +4482,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2019_12_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -3534,10 +4498,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2019_12_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2019_12_01.models.SubResource """ _validation = { @@ -3557,6 +4521,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2019_12_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -3565,16 +4535,16 @@ def __init__( 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 + :ivar 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.v2019_12_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2019_12_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool """ _attribute_map = { @@ -3591,6 +4561,18 @@ def __init__( provision_vm_agent: Optional[bool] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2019_12_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -3602,11 +4584,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2019_12_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3625,6 +4607,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3635,19 +4624,19 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -3676,6 +4665,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -3706,6 +4710,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -3731,6 +4737,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -3738,23 +4746,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2019_12_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -3779,6 +4787,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2019_12_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -3794,8 +4821,8 @@ class ManagedArtifact(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The managed artifact id. - :type id: str + :ivar id: Required. The managed artifact id. + :vartype id: str """ _validation = { @@ -3812,6 +4839,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ super(ManagedArtifact, self).__init__(**kwargs) self.id = id @@ -3819,15 +4850,17 @@ def __init__( 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: + :ivar id: Resource Id. + :vartype id: str + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -3844,6 +4877,19 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -3852,11 +4898,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -3871,6 +4917,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -3878,9 +4931,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2019_12_01.models.NetworkInterfaceReference] """ @@ -3894,6 +4947,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2019_12_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -3903,12 +4962,12 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_name: Required. The name of the service. Possible values include: + :ivar service_name: Required. The name of the service. Possible values include: "AutomaticRepairs", "DummyOrchestrationServiceName". - :type service_name: str or ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", + :vartype service_name: str or ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames + :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". - :type action: str or ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceStateAction + :vartype action: str or ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceStateAction """ _validation = { @@ -3928,6 +4987,16 @@ def __init__( action: Union[str, "OrchestrationServiceStateAction"], **kwargs ): + """ + :keyword service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :paramtype service_name: str or + ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames + :keyword action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :paramtype action: str or + ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceStateAction + """ super(OrchestrationServiceStateInput, self).__init__(**kwargs) self.service_name = service_name self.action = action @@ -3960,6 +5029,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrchestrationServiceSummary, self).__init__(**kwargs) self.service_name = None self.service_state = None @@ -3970,48 +5041,48 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2019_12_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :ivar 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.v2019_12_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :ivar 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.v2019_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_12_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2019_12_01.models.DiffDiskSettings + :ivar 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.v2019_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :ivar 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.v2019_12_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.ManagedDiskParameters """ _validation = { @@ -4048,6 +5119,50 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2019_12_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -4067,9 +5182,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes """ _validation = { @@ -4086,6 +5201,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -4093,9 +5213,9 @@ def __init__( class OSDiskImageEncryption(DiskImageEncryption): """Contains encryption settings for an OS disk image. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str + :vartype disk_encryption_set_id: str """ _attribute_map = { @@ -4108,36 +5228,40 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ super(OSDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) 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. + :ivar 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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -4152,8 +5276,8 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 @@ -4163,28 +5287,27 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration + :ivar 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.v2019_12_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar require_guest_provision_signal: Specifies whether the guest provision signal is required to infer provision success of the virtual machine. - :type require_guest_provision_signal: bool + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -4213,6 +5336,79 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword require_guest_provision_signal: Specifies whether the guest provision signal is + required to infer provision success of the virtual machine. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -4228,15 +5424,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -4255,6 +5451,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4275,15 +5482,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -4297,8 +5504,8 @@ class ProximityPlacementGroup(Resource): placement group. :vartype availability_sets: list[~azure.mgmt.compute.v2019_12_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus """ _validation = { @@ -4333,6 +5540,20 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -4346,10 +5567,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2019_12_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -4368,6 +5589,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4376,8 +5603,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -4390,6 +5617,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -4398,13 +5629,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -4427,6 +5658,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -4436,10 +5676,10 @@ def __init__( class RecommendedMachineConfiguration(msrest.serialization.Model): """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange """ _attribute_map = { @@ -4454,6 +5694,12 @@ def __init__( memory: Optional["ResourceRange"] = None, **kwargs ): + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2019_12_01.models.ResourceRange + """ super(RecommendedMachineConfiguration, self).__init__(**kwargs) self.v_cp_us = v_cp_us self.memory = memory @@ -4485,6 +5731,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -4524,6 +5772,8 @@ def __init__( self, **kwargs ): + """ + """ super(RegionalReplicationStatus, self).__init__(**kwargs) self.region = None self.state = None @@ -4559,6 +5809,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = None @@ -4569,22 +5821,22 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 interval_length: Required. Interval value in minutes used to create LogAnalytics call + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar 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.v2019_12_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2019_12_01.models.IntervalInMins """ _validation = { @@ -4616,6 +5868,24 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2019_12_01.models.IntervalInMins + """ 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, **kwargs) self.interval_length = interval_length @@ -4623,10 +5893,10 @@ def __init__( class ResourceRange(msrest.serialization.Model): """Describes the resource range. - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int """ _attribute_map = { @@ -4641,6 +5911,12 @@ def __init__( max: Optional[int] = None, **kwargs ): + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ super(ResourceRange, self).__init__(**kwargs) self.min = min self.max = max @@ -4676,6 +5952,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -4685,26 +5963,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -4729,6 +6007,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -4770,6 +6070,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -4812,6 +6114,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -4832,10 +6136,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -4877,6 +6181,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -4889,17 +6199,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_12_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 + :vartype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -4928,6 +6238,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -4941,21 +6264,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2019_12_01.models.RunCommandParameterDefinition] """ _validation = { @@ -4989,6 +6312,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2019_12_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -4999,13 +6340,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2019_12_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2019_12_01.models.RunCommandInputParameter] """ _validation = { @@ -5026,6 +6367,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2019_12_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -5037,10 +6387,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -5060,6 +6410,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -5070,11 +6426,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2019_12_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5093,6 +6449,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5103,14 +6466,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -5134,6 +6497,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -5144,8 +6517,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5158,6 +6531,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -5165,7 +6542,7 @@ def __init__( 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. + :ivar 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 @@ -5179,7 +6556,7 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetScaleInRules] """ @@ -5193,6 +6570,24 @@ def __init__( rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetScaleInRules] + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules @@ -5200,9 +6595,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2019_12_01.models.TerminateNotificationProfile """ @@ -5216,6 +6611,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2019_12_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -5223,14 +6624,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -5247,6 +6648,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5256,8 +6667,8 @@ def __init__( 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.v2019_12_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2019_12_01.models.SshPublicKey] """ _attribute_map = { @@ -5270,6 +6681,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2019_12_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -5277,15 +6692,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -5300,6 +6715,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -5310,16 +6736,16 @@ class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): 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 + :ivar 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 + :vartype private_key: str + :ivar 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 + :vartype public_key: str + :ivar id: Required. The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - :type id: str + :vartype id: str """ _validation = { @@ -5342,6 +6768,18 @@ def __init__( id: str, **kwargs ): + """ + :keyword 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. + :paramtype private_key: str + :keyword 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. + :paramtype public_key: str + :keyword id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :paramtype id: str + """ super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) self.private_key = private_key self.public_key = public_key @@ -5361,15 +6799,15 @@ class SshPublicKeyResource(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _validation = { @@ -5396,6 +6834,17 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyResource, self).__init__(location=location, tags=tags, **kwargs) self.public_key = public_key @@ -5405,11 +6854,11 @@ class SshPublicKeysGroupListResult(msrest.serialization.Model): 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.v2019_12_01.models.SshPublicKeyResource] - :param next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + :ivar value: Required. The list of SSH public keys. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeyResource] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5428,6 +6877,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of SSH public keys. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeyResource] + :keyword 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. + :paramtype next_link: str + """ super(SshPublicKeysGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5436,13 +6892,13 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _attribute_map = { @@ -5457,6 +6913,15 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyUpdateResource, self).__init__(tags=tags, **kwargs) self.public_key = public_key @@ -5464,21 +6929,21 @@ def __init__( 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 + :ivar 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.v2019_12_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2019_12_01.models.ImageReference + :ivar 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.v2019_12_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_12_01.models.OSDisk + :ivar 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.v2019_12_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.DataDisk] """ _attribute_map = { @@ -5495,6 +6960,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2019_12_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_12_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -5522,6 +7004,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -5529,11 +7013,11 @@ def __init__( class SubResourceWithColocationStatus(SubResource): """SubResourceWithColocationStatus. - :param id: Resource Id. - :type id: str - :param colocation_status: Describes colocation status of a resource in the Proximity Placement + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus + :vartype colocation_status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus """ _attribute_map = { @@ -5548,6 +7032,13 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword colocation_status: Describes colocation status of a resource in the Proximity + Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus + """ super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) self.colocation_status = colocation_status @@ -5557,18 +7048,18 @@ class TargetRegion(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per + :ivar name: Required. The name of the region. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. + :vartype regional_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType - :param encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :type encryption: ~azure.mgmt.compute.v2019_12_01.models.EncryptionImages + :vartype storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS + and data disks in the gallery artifact. + :vartype encryption: ~azure.mgmt.compute.v2019_12_01.models.EncryptionImages """ _validation = { @@ -5591,6 +7082,21 @@ def __init__( encryption: Optional["EncryptionImages"] = None, **kwargs ): + """ + :keyword name: Required. The name of the region. + :paramtype name: str + :keyword regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :paramtype regional_replica_count: int + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType + :keyword encryption: Optional. Allows users to provide customer managed keys for encrypting the + OS and data disks in the gallery artifact. + :paramtype encryption: ~azure.mgmt.compute.v2019_12_01.models.EncryptionImages + """ super(TargetRegion, self).__init__(**kwargs) self.name = name self.regional_replica_count = regional_replica_count @@ -5601,13 +7107,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -5622,6 +7128,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -5632,19 +7147,19 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool """ _validation = { @@ -5673,6 +7188,21 @@ def __init__( group_by_resource_name: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + """ 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, **kwargs) @@ -5706,6 +7236,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -5754,6 +7286,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -5793,6 +7327,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -5802,19 +7338,19 @@ def __init__( 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.v2019_12_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2019_12_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.AutomaticOSUpgradePolicy """ @@ -5832,6 +7368,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2019_12_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2019_12_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -5847,12 +7399,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2019_12_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2019_12_01.models.UsageName """ _validation = { @@ -5879,6 +7431,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2019_12_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -5888,10 +7448,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -5906,6 +7466,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -5916,16 +7482,16 @@ class UserArtifactManage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param install: Required. Required. The path and arguments to install the gallery application. + :ivar install: Required. Required. The path and arguments to install the gallery application. This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. + :vartype install: str + :ivar remove: Required. Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not + :vartype remove: str + :ivar update: Optional. The path and arguments to update the gallery application. If not present, then update operation will invoke remove command on the previous version and install command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str + :vartype update: str """ _validation = { @@ -5947,6 +7513,18 @@ def __init__( update: Optional[str] = None, **kwargs ): + """ + :keyword install: Required. Required. The path and arguments to install the gallery + application. This is limited to 4096 characters. + :paramtype install: str + :keyword remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :paramtype remove: str + :keyword update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :paramtype update: str + """ super(UserArtifactManage, self).__init__(**kwargs) self.install = install self.remove = remove @@ -5958,12 +7536,12 @@ class UserArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + :ivar media_link: Required. Required. The mediaLink of the artifact, must be a readable storage + page blob. + :vartype media_link: str + :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. - :type default_configuration_link: str + :vartype default_configuration_link: str """ _validation = { @@ -5982,6 +7560,14 @@ def __init__( default_configuration_link: Optional[str] = None, **kwargs ): + """ + :keyword media_link: Required. Required. The mediaLink of the artifact, must be a readable + storage page blob. + :paramtype media_link: str + :keyword default_configuration_link: Optional. The defaultConfigurationLink of the artifact, + must be a readable storage page blob. + :paramtype default_configuration_link: str + """ super(UserArtifactSource, self).__init__(**kwargs) self.media_link = media_link self.default_configuration_link = default_configuration_link @@ -6012,6 +7598,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6020,21 +7608,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -6049,6 +7637,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -6057,12 +7662,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2019_12_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2019_12_01.models.VaultCertificate] """ _attribute_map = { @@ -6077,6 +7682,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2019_12_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -6085,8 +7698,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -6099,6 +7712,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -6116,38 +7733,38 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_12_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :ivar 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.v2019_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :ivar 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 @@ -6160,42 +7777,41 @@ class VirtualMachine(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.v2019_12_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 + :vartype availability_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar 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.v2019_12_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar 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.v2019_12_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.v2019_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2019_12_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.v2019_12_01.models.SubResource + :vartype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -6203,7 +7819,7 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -6273,6 +7889,91 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -6300,13 +8001,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6323,6 +8024,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -6334,13 +8044,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -6363,6 +8073,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -6374,8 +8093,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -6407,6 +8126,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -6427,33 +8150,34 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2019_12_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -6496,6 +8220,34 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -6511,12 +8263,12 @@ def __init__( 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.v2019_12_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus """ _attribute_map = { @@ -6533,6 +8285,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -6552,23 +8312,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -6603,6 +8363,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -6614,16 +8393,16 @@ def __init__( 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.v2019_12_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6644,6 +8423,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -6655,8 +8446,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -6669,6 +8460,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -6676,26 +8471,26 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -6722,6 +8517,28 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -6753,6 +8570,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -6768,15 +8587,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2019_12_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2019_12_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_12_01.models.UserAssignedIdentitiesValue] """ @@ -6799,6 +8618,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2019_12_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2019_12_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -6811,16 +8642,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -6844,6 +8675,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -6855,29 +8698,30 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2019_12_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2019_12_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2019_12_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes """ _validation = { @@ -6911,6 +8755,33 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2019_12_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2019_12_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2019_12_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2019_12_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationTypes + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -6922,38 +8793,38 @@ def __init__( class VirtualMachineInstanceView(msrest.serialization.Model): """The instance view of a virtual machine. - :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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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.v2019_12_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.v2019_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2019_12_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView] - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2019_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_12_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6990,6 +8861,41 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2019_12_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2019_12_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_12_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -7011,11 +8917,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2019_12_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7034,6 +8940,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7042,9 +8955,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -7057,6 +8970,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -7074,62 +8992,62 @@ class VirtualMachineScaleSet(Resource): :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.v2019_12_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :ivar 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.v2019_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2019_12_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar 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 + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2019_12_01.models.SubResource - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar 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.v2019_12_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :ivar 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.v2019_12_01.models.ScaleInPolicy + :vartype scale_in_policy: ~azure.mgmt.compute.v2019_12_01.models.ScaleInPolicy """ _validation = { @@ -7188,6 +9106,62 @@ def __init__( scale_in_policy: Optional["ScaleInPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2019_12_01.models.ScaleInPolicy + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -7213,39 +9187,39 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2019_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetManagedDiskParameters - :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + :ivar 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. + :vartype disk_iops_read_write: long + :ivar 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 + :vartype disk_m_bps_read_write: long """ _validation = { @@ -7279,6 +9253,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword 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. + :paramtype disk_iops_read_write: long + :keyword 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. + :paramtype disk_m_bps_read_write: long + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -7298,34 +9307,34 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -7363,6 +9372,32 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.type = None @@ -7382,11 +9417,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2019_12_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7405,6 +9440,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7413,8 +9455,9 @@ def __init__( 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.v2019_12_01.models.VirtualMachineScaleSetExtension] + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] """ _attribute_map = { @@ -7427,6 +9470,11 @@ def __init__( extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -7442,30 +9490,30 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -7503,6 +9551,30 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -7528,17 +9600,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2019_12_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: + :vartype type: str or ~azure.mgmt.compute.v2019_12_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -7561,6 +9632,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2019_12_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -7593,6 +9678,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -7609,8 +9696,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] :ivar orchestration_services: The orchestration services information. :vartype orchestration_services: list[~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceSummary] @@ -7635,6 +9722,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -7664,6 +9755,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -7673,39 +9766,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2019_12_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2019_12_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2019_12_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :ivar 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: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :ivar 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. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.SubResource] """ _validation = { @@ -7740,6 +9834,44 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2019_12_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -7755,10 +9887,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -7773,6 +9905,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -7783,11 +9921,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2019_12_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2019_12_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7806,6 +9945,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2019_12_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7816,11 +9963,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2019_12_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7839,6 +9986,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7849,11 +10003,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2019_12_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7872,6 +10026,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7882,11 +10043,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2019_12_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7905,6 +10066,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7913,14 +10081,16 @@ def __init__( 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. 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. Possible values include: + :ivar storage_account_type: 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. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -7935,6 +10105,18 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2019_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2019_12_01.models.DiskEncryptionSetParameters + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -7945,26 +10127,26 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -7995,6 +10177,28 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -8008,8 +10212,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -8022,6 +10226,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -8029,12 +10237,12 @@ def __init__( 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 + :ivar 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.v2019_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -8050,6 +10258,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -8060,43 +10277,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2019_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2019_12_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :ivar 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.v2019_12_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2019_12_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2019_12_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -8132,6 +10349,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2019_12_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2019_12_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2019_12_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -8148,25 +10405,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -8181,27 +10437,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration + :ivar 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.v2019_12_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.v2019_12_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] """ _attribute_map = { @@ -8226,6 +10482,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -8241,21 +10553,21 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar 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.v2019_12_01.models.IPVersion + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2019_12_01.models.IPVersion """ _validation = { @@ -8282,6 +10594,23 @@ def __init__( public_ip_address_version: Optional[Union[str, "IPVersion"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2019_12_01.models.IPVersion + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -8296,10 +10625,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -8316,6 +10645,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -8323,9 +10658,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -8338,19 +10673,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -8365,6 +10705,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -8398,6 +10747,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -8439,6 +10790,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -8449,21 +10802,22 @@ def __init__( 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 + :ivar 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.v2019_12_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2019_12_01.models.ImageReference + :ivar 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.v2019_12_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2019_12_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -8480,6 +10834,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2019_12_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -8489,45 +10861,45 @@ def __init__( 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.v2019_12_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2019_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2019_12_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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.v2019_12_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :ivar 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.v2019_12_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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2019_12_01.models.ScaleInPolicy + :ivar 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.v2019_12_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource """ _attribute_map = { @@ -8564,6 +10936,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2019_12_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2019_12_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2019_12_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2019_12_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -8582,34 +10997,34 @@ def __init__( 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.v2019_12_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2019_12_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2019_12_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.SubResource] """ _attribute_map = { @@ -8640,6 +11055,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2019_12_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2019_12_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -8655,25 +11102,25 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated networking-enabled. - :type enable_accelerated_networking: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -8700,6 +11147,27 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -8713,12 +11181,12 @@ def __init__( 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 + :ivar 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.v2019_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -8734,6 +11202,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -8742,23 +11219,23 @@ def __init__( 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.v2019_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2019_12_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: + :vartype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -8782,6 +11259,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2019_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2019_12_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -8794,14 +11291,14 @@ def __init__( 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.v2019_12_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] """ _attribute_map = { @@ -8820,6 +11317,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2019_12_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -8830,12 +11337,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -8853,6 +11360,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -8862,12 +11378,13 @@ def __init__( 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.v2019_12_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2019_12_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -8884,6 +11401,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2019_12_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -8893,26 +11419,28 @@ def __init__( 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.v2019_12_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2019_12_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. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar 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.v2019_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -8939,6 +11467,30 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -8963,20 +11515,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2019_12_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2019_12_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -8989,26 +11541,26 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile + :ivar 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.v2019_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :ivar 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 @@ -9018,10 +11570,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2019_12_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2019_12_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 + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -9029,12 +11581,12 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMProtectionPolicy """ @@ -9100,6 +11652,61 @@ def __init__( protection_policy: Optional["VirtualMachineScaleSetVMProtectionPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMProtectionPolicy + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -9149,6 +11756,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -9157,10 +11766,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -9173,6 +11782,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -9182,8 +11797,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -9200,6 +11815,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -9209,34 +11828,34 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2019_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2019_12_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2019_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] - :param placement_group_id: The placement group in which the VM is running. If the VM is + :vartype boot_diagnostics: ~azure.mgmt.compute.v2019_12_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -9272,6 +11891,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2019_12_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2019_12_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2019_12_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -9291,11 +11938,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9314,6 +11961,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9322,8 +11976,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -9337,6 +11991,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -9344,24 +12003,24 @@ def __init__( 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.v2019_12_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -9369,24 +12028,25 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows 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. + :vartype license_type: str + :ivar 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.v2019_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype priority: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :ivar 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.v2019_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -9417,6 +12077,52 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetNetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2019_12_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -9433,13 +12139,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -9454,6 +12160,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -9462,20 +12177,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -9498,6 +12213,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -9510,8 +12241,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSize] """ _attribute_map = { @@ -9524,6 +12255,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -9553,6 +12288,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -9563,34 +12300,34 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2019_12_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :ivar 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.v2019_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :ivar 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 @@ -9603,42 +12340,41 @@ class VirtualMachineUpdate(UpdateResource): 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.v2019_12_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 + :vartype availability_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar 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.v2019_12_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar 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.v2019_12_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.v2019_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2019_12_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.v2019_12_01.models.SubResource + :vartype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2019_12_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.v2019_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar license_type: Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in @@ -9646,7 +12382,7 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 @@ -9705,6 +12441,89 @@ def __init__( license_type: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2019_12_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2019_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2019_12_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2019_12_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2019_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2019_12_01.models.NetworkProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2019_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2019_12_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2019_12_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2019_12_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. This element is only used for images that contain the Windows Server operating + system. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` Windows_Client + :code:`
    `:code:`
    ` Windows_Server :code:`
    `:code:`
    ` If this element is included in + a request for an update, the value must match the initial value. This value cannot be updated. + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -9731,11 +12550,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -9748,6 +12567,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -9755,28 +12581,28 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". + :vartype enable_automatic_updates: bool + :ivar 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 + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2019_12_01.models.AdditionalUnattendContent] - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2019_12_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2019_12_01.models.WinRMConfiguration """ _attribute_map = { @@ -9797,6 +12623,30 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword 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 + `_. + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2019_12_01.models.AdditionalUnattendContent] + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2019_12_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -9808,8 +12658,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2019_12_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2019_12_01.models.WinRMListener] """ _attribute_map = { @@ -9822,6 +12672,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2019_12_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -9829,18 +12683,18 @@ def __init__( 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 + :ivar 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.v2019_12_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2019_12_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -9855,6 +12709,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2019_12_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py index 4e9bfef669fd..af732d0f517f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2019_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2019_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py index f460880de576..35b39d139f57 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py @@ -5,23 +5,242 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +264,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +292,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +325,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +355,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +384,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +411,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,13 +434,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -262,27 +458,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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] - 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,22 +482,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -319,35 +509,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -365,22 +551,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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.v2019_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -388,34 +577,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -433,6 +617,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py index e490756ba264..ea9394970173 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2019_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2019_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHost" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -449,7 +616,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -461,30 +629,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -498,15 +655,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -515,8 +674,10 @@ def list_by_host_group( :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.v2019_12_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -524,36 +685,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py index 3ba51a9743d6..b1af75e83198 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleriesOperations(object): """GalleriesOperations operations. @@ -49,43 +274,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -106,16 +320,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Create or update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -127,15 +343,18 @@ def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2019_12_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +366,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,47 +392,37 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -233,16 +436,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -254,15 +459,18 @@ def begin_update( :type gallery: ~azure.mgmt.compute.v2019_12_01.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,27 +482,21 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -306,15 +508,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> "_models.Gallery": """Retrieves information about a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -331,27 +534,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -365,41 +558,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> 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 = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -412,13 +596,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -427,15 +612,17 @@ def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -449,21 +636,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -475,14 +655,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a resource group. :param resource_group_name: The name of the resource group. @@ -497,35 +678,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -543,16 +720,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -565,34 +743,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,6 +783,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py index 9a664ba0492f..376df6ca97cd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_application_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationVersionsOperations(object): """GalleryApplicationVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -139,18 +348,24 @@ def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +379,21 @@ def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +405,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -256,18 +453,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -285,18 +484,24 @@ def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +515,21 @@ def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +541,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": """Retrieves information about a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -381,31 +579,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,45 +606,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> 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 = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -470,15 +648,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -494,15 +673,17 @@ def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -518,23 +699,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -546,16 +718,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationVersionList"]: """List gallery Application Versions in a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -567,8 +740,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -576,37 +751,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -624,6 +797,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py index c7c6ac2be35c..d3f28b1dc3ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationsOperations(object): """GalleryApplicationsOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -135,15 +330,20 @@ def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -156,28 +356,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,49 +382,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -245,17 +428,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -271,15 +456,20 @@ def begin_update( :type gallery_application: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +482,21 @@ def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,16 +508,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> "_models.GalleryApplication": """Retrieves information about a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -355,28 +539,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,43 +564,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> 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 = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -439,14 +604,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application. :param resource_group_name: The name of the resource group. @@ -458,15 +624,17 @@ def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -481,22 +649,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -508,15 +668,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationList"]: """List gallery Application Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -525,8 +686,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -534,36 +697,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -581,6 +741,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py index acda04f1dc3b..1c05a6ff4e38 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_image_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImageVersionsOperations(object): """GalleryImageVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Create or update a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -142,15 +351,20 @@ def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +378,21 @@ def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +404,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -256,18 +452,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Update a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -288,15 +486,20 @@ def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +513,21 @@ def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +539,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": """Retrieves information about a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -380,31 +576,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -418,45 +603,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> 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 = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -469,15 +645,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Image Version. :param resource_group_name: The name of the resource group. @@ -492,15 +669,17 @@ def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -516,23 +695,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,16 +714,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageVersionList"]: """List gallery Image Versions in a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -565,8 +736,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -574,37 +747,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -622,6 +793,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py index 8a234714f270..fe0178474414 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImagesOperations(object): """GalleryImagesOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Create or update a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -134,15 +329,19 @@ def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,28 +354,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -188,49 +380,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Update a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -270,15 +454,19 @@ def begin_update( :type gallery_image: ~azure.mgmt.compute.v2019_12_01.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +479,21 @@ def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,16 +505,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": """Retrieves information about a gallery Image Definition. :param resource_group_name: The name of the resource group. @@ -353,28 +535,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,43 +560,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> 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 = "2019-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,14 +600,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image. :param resource_group_name: The name of the resource group. @@ -456,15 +620,17 @@ def begin_delete( :type gallery_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,22 +645,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -506,15 +664,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageList"]: """List gallery Image Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -532,36 +691,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -579,6 +735,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py index c0b7a25ea2d4..95805e6ee49c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2019_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py index 3af4b3c21020..cfb237fc62bd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py index 97b37638b781..b6904730a31b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2019_12_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py index 99b1050978e7..eacb649cdd43 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = _SERIALIZER.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +294,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +327,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +357,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +386,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +413,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,14 +436,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -264,29 +464,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,18 +489,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2019_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -319,34 +512,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,24 +552,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -389,35 +580,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +622,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py index 779efa1ff9c4..ef5b1adaa0f7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py @@ -5,23 +5,277 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_key_pair_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SshPublicKeysOperations(object): """SshPublicKeysOperations operations. @@ -45,17 +299,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + **kwargs: Any + ) -> 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.v2019_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -63,34 +319,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,25 +359,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -134,35 +388,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,19 +430,20 @@ def get_next(next_link=None): 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 + @distributed_trace def create( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -211,32 +462,22 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyResource') + + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,16 +495,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyUpdateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyUpdateResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -282,32 +525,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -321,15 +554,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> None: """Delete an SSH public key. :param resource_group_name: The name of the resource group. @@ -346,25 +581,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,13 +604,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Retrieves information about an SSH public key. :param resource_group_name: The name of the resource group. @@ -400,27 +628,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,15 +652,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def generate_key_pair( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyGenerateKeyPairResult" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_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. @@ -461,27 +681,17 @@ def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,4 +705,6 @@ def generate_key_pair( 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/v2019_12_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py index a724d1d11106..75e17612989f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py index c57d3f6881cb..947d529cd9e4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2019_12_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extensions_operations.py index b5bd929d4c3e..57338c5b029e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2019_12_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_images_operations.py index 466937425427..7136d0ff7538 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2019_12_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_run_commands_operations.py index f25a409f6bb7..ec94e1ce7eff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_run_commands_operations.py @@ -5,23 +5,93 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -45,19 +115,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -65,35 +137,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +179,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -139,27 +208,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,4 +232,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py index 4f5e0f0b368c..f1f89da5e797 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +320,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +350,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +376,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to update an extension. :param resource_group_name: The name of the resource group. @@ -265,18 +449,24 @@ def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -289,28 +479,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -322,41 +505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +544,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -387,15 +563,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +588,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,17 +607,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -468,30 +639,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +665,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -521,8 +683,10 @@ def list( :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.v2019_12_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -530,36 +694,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -577,6 +738,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index a65a788baa18..4204209dd426 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 215995870701..1d7156c1e3a9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,24 +5,246 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMExtensionsOperations(object): """VirtualMachineScaleSetVMExtensionsOperations operations. @@ -48,47 +270,36 @@ def __init__(self, client, config, serializer, deserializer): 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.VirtualMachineExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtension" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,18 +317,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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.VirtualMachineExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineExtension"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -133,15 +346,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +373,21 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +399,41 @@ def get_long_running_output(pipeline_response): ) 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.VirtualMachineExtensionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtension" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +447,20 @@ def _update_initial( 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 + + @distributed_trace 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.VirtualMachineExtensionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineExtension"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -271,18 +473,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +504,21 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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'), - '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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -330,45 +530,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,15 +571,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -402,15 +593,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,23 +619,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,18 +638,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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.VirtualMachineExtension" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -488,31 +673,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,17 +700,19 @@ def get( 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 + + @distributed_trace 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.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of an instance in Virtual Machine Scaleset. :param resource_group_name: The name of the resource group. @@ -557,30 +733,19 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,4 +759,6 @@ def list( 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/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py index 02910d832545..07edfb0f8c4f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,570 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +594,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +637,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +656,22 @@ def begin_reimage( :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.v2019_12_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +684,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +707,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +746,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +766,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +791,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +810,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +849,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +870,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +895,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +914,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +964,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +990,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +1016,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,41 +1042,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,14 +1081,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -609,15 +1100,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -632,22 +1125,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -659,17 +1144,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -678,7 +1164,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -690,30 +1177,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -727,16 +1203,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -755,28 +1233,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -790,18 +1258,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -818,8 +1288,10 @@ def list( '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.v2019_12_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -827,42 +1299,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -880,6 +1349,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -887,40 +1357,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -933,15 +1393,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -958,15 +1419,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -982,22 +1445,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1009,41 +1464,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1056,14 +1503,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1074,15 +1522,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1097,22 +1547,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1124,41 +1566,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1171,14 +1605,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1189,15 +1624,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1212,22 +1649,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1239,41 +1668,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1286,14 +1707,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1305,15 +1727,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1328,22 +1752,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1355,41 +1771,33 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1402,14 +1810,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in a VMScaleSet, moves it to an already updated node, and powers it back on during the self-service phase of planned maintenance. @@ -1421,15 +1830,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1444,22 +1855,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1471,16 +1874,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> None: """The operation to simulate the eviction of spot virtual machine in a VM scale set. The eviction will occur within 30 minutes of calling the API. @@ -1500,26 +1904,18 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1532,47 +1928,37 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1588,17 +1974,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1611,15 +1999,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2019_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1632,28 +2024,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1665,4 +2050,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py index 8d4f89058dd3..02c3d37f0a22 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,894 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_set_orchestration_service_state_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +918,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +961,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +983,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +1008,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +1034,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +1078,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1100,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1125,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,39 +1151,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,13 +1188,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -361,15 +1204,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +1228,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -409,15 +1247,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -434,27 +1273,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,48 +1297,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,14 +1344,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -539,18 +1362,22 @@ def begin_deallocate( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,24 +1389,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,45 +1412,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -642,14 +1455,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -657,18 +1471,22 @@ def begin_delete_instances( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -680,24 +1498,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -709,15 +1521,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -734,27 +1547,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -768,21 +1571,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -790,35 +1597,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,23 +1639,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2019_12_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -860,34 +1666,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,18 +1706,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -925,8 +1727,10 @@ def list_skus( :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.v2019_12_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -934,36 +1738,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -981,18 +1782,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1000,8 +1802,10 @@ def get_os_upgrade_history( :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.v2019_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1009,36 +1813,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,6 +1857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1063,47 +1865,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1116,15 +1908,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1138,18 +1931,22 @@ def begin_power_off( 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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1162,24 +1959,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1191,48 +1982,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1245,14 +2028,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1260,18 +2044,22 @@ def begin_restart( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1283,24 +2071,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1312,48 +2094,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1366,14 +2140,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1381,18 +2156,22 @@ def begin_start( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1404,24 +2183,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1433,48 +2206,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1487,14 +2252,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1503,18 +2269,22 @@ def begin_redeploy( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1526,24 +2296,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1555,48 +2319,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1609,14 +2365,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1627,18 +2384,22 @@ def begin_perform_maintenance( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1650,24 +2411,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1679,45 +2434,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1730,14 +2477,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1745,18 +2493,22 @@ def begin_update_instances( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1768,24 +2520,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1797,48 +2543,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1851,14 +2589,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1868,18 +2607,22 @@ def begin_reimage( :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.v2019_12_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1891,24 +2634,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1920,48 +2657,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1974,14 +2703,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1990,18 +2720,22 @@ def begin_reimage_all( :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2013,24 +2747,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2042,16 +2770,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2072,28 +2801,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2107,16 +2826,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to true for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2124,7 +2845,8 @@ def convert_to_single_placement_group( :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.v2019_12_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2019_12_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 @@ -2135,30 +2857,22 @@ def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2171,43 +2885,35 @@ def convert_to_single_placement_group( 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2220,14 +2926,15 @@ def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. @@ -2238,15 +2945,18 @@ def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2258,24 +2968,18 @@ def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2287,4 +2991,5 @@ def get_long_running_output(pipeline_response): ) 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/v2019_12_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_sizes_operations.py index cf971748f531..70c91b33ccbe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py index 9115904be71c..534ca80a8c93 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py @@ -5,25 +5,785 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +807,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +829,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +871,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +879,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +920,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +943,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2019_12_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +968,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +994,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +1042,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. @@ -324,15 +1065,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2019_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -344,27 +1089,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,47 +1115,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -434,16 +1163,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -454,15 +1185,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2019_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,27 +1209,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -506,39 +1235,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -551,13 +1272,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a virtual machine. :param resource_group_name: The name of the resource group. @@ -566,15 +1288,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -588,21 +1312,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -614,23 +1331,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -642,29 +1361,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -678,15 +1386,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -703,27 +1413,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -737,39 +1437,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -782,13 +1475,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. :code:`
    `For Windows, please refer to `Convert a virtual machine from unmanaged disks to managed disks. @@ -802,15 +1496,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -824,21 +1520,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -850,39 +1539,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -895,13 +1576,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -911,15 +1593,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -933,21 +1617,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -959,15 +1636,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 @@ -989,25 +1667,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,20 +1690,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2019_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1041,35 +1714,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1087,17 +1756,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - status_only=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + status_only: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -1105,8 +1775,10 @@ def list_all( 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.v2019_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1114,36 +1786,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1161,18 +1828,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1181,8 +1849,10 @@ def list_available_sizes( :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.v2019_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1190,36 +1860,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1237,6 +1904,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1244,38 +1912,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1288,14 +1946,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1309,15 +1968,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1332,21 +1993,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1358,41 +2012,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1405,13 +2049,14 @@ def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace def begin_reapply( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to reapply a virtual machine's state. :param resource_group_name: The name of the resource group. @@ -1420,15 +2065,17 @@ def begin_reapply( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1442,21 +2089,14 @@ def begin_reapply( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1468,39 +2108,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1513,13 +2145,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1528,15 +2161,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1550,21 +2185,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1576,39 +2204,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1621,13 +2241,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1636,15 +2257,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1658,21 +2281,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1684,39 +2300,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1729,13 +2337,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1744,15 +2353,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1766,21 +2377,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1792,48 +2396,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1846,14 +2442,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1864,15 +2461,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1884,24 +2484,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1913,39 +2507,31 @@ def get_long_running_output(pipeline_response): ) 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 _perform_maintenance_initial( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2019-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1958,13 +2544,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine, moves it to an already updated node, and powers it back on during the self-service phase of planned maintenance. @@ -1974,15 +2561,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1996,21 +2585,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2022,15 +2604,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of calling the API. @@ -2048,25 +2631,17 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2079,45 +2654,35 @@ def simulate_eviction( simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction'} # 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2019-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2133,16 +2698,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2153,15 +2720,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2019_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2019_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2173,27 +2744,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2205,4 +2770,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py index 4d26c528f5e0..091c6301d598 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -34,61 +29,66 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_05_01.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_05_01.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_05_01.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_05_01.operations.DiskAccessesOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py index 236004dede34..019822c771dc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json index 7028a801e5b9..d934bc9eea7d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "disks": "DisksOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py index 71ef125605c4..ba1a1b9dc0e1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -32,59 +29,66 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_05_01.aio.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_05_01.aio.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_05_01.aio.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_05_01.aio.operations.DiskAccessesOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py index b2ea43b9b84d..1bf67ffe0582 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py index 6ababed65ef7..c6a067d4e006 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_accesses_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_private_link_resources_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_05_01.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_05_01.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -423,15 +397,17 @@ async def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -445,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -471,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -484,7 +455,8 @@ def list_by_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 DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -492,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -538,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -551,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -559,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,11 +570,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace_async async def get_private_link_resources( self, resource_group_name: str, @@ -633,27 +601,17 @@ async def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -667,4 +625,6 @@ async def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py index 68544b7e217d..b3bd7f2fa394 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,20 @@ async def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore async def _update_initial( @@ -186,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,8 +293,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -329,27 +321,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -363,8 +345,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -376,27 +360,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,6 +383,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -425,15 +401,17 @@ async def begin_delete( :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -447,21 +425,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,8 +444,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +458,10 @@ def list_by_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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -494,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -552,8 +525,10 @@ def list( """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -561,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py index 3f271e6541ec..69a607685412 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_05_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2020_05_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_05_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py index 26840d0ee1bf..2c946d7c0248 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_05_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_05_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_05_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/__init__.py index dc6664b20a1b..3a8b16641e74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/__init__.py @@ -6,78 +6,42 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import CreationData - from ._models_py3 import Disk - from ._models_py3 import DiskAccess - from ._models_py3 import DiskAccessList - from ._models_py3 import DiskAccessUpdate - from ._models_py3 import DiskEncryptionSet - from ._models_py3 import DiskEncryptionSetList - from ._models_py3 import DiskEncryptionSetUpdate - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import Encryption - from ._models_py3 import EncryptionSetIdentity - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import GrantAccessData - from ._models_py3 import ImageDiskReference - from ._models_py3 import InnerError - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import Resource - from ._models_py3 import ShareInfoElement - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - from ._models import ApiError # type: ignore - from ._models import ApiErrorBase # type: ignore - from ._models import CreationData # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskAccess # type: ignore - from ._models import DiskAccessList # type: ignore - from ._models import DiskAccessUpdate # type: ignore - from ._models import DiskEncryptionSet # type: ignore - from ._models import DiskEncryptionSetList # type: ignore - from ._models import DiskEncryptionSetUpdate # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionSetIdentity # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import ImageDiskReference # type: ignore - from ._models import InnerError # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import Resource # type: ignore - from ._models import ShareInfoElement # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore +from ._models_py3 import AccessUri +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import CreationData +from ._models_py3 import Disk +from ._models_py3 import DiskAccess +from ._models_py3 import DiskAccessList +from ._models_py3 import DiskAccessUpdate +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import GrantAccessData +from ._models_py3 import ImageDiskReference +from ._models_py3 import InnerError +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ShareInfoElement +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_compute_management_client_enums.py index 189af62ac8ad..de0d8f572589 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -55,13 +40,13 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the disk. UPLOAD = "Upload" -class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. """ SYSTEM_ASSIGNED = "SystemAssigned" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the disk. """ @@ -78,7 +63,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -93,7 +78,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: databases (for example, SQL, Oracle), and other transaction-heavy workloads. ULTRA_SSD_LRS = "UltraSSD_LRS" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -107,14 +92,14 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAccessPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for accessing the disk via network. """ @@ -125,14 +110,14 @@ class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The disk cannot be exported. DENY_ALL = "DenyAll" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -141,7 +126,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -149,7 +134,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models.py deleted file mode 100644 index 0b234723c7f7..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models.py +++ /dev/null @@ -1,1467 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -class ApiError(msrest.serialization.Model): - """Api error. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_05_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_05_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_05_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the - ImageDiskReference will be the ARM id of the shared galley image version from which to create a - disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'gallery_image_reference': {'key': 'galleryImageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.gallery_image_reference = kwargs.get('gallery_image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the - disk attached. maxShares should be set to a value greater than one for disks to allow attaching - them to multiple VMs. - :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2020_05_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should - be set to a value greater than one for disks to allow attaching them to multiple VMs. - :vartype share_info: list[~azure.mgmt.compute.v2020_05_01.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'managed_by_extended': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'share_info': {'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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'managed_by_extended': {'key': 'managedByExtended', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'share_info': {'key': 'properties.shareInfo', 'type': '[ShareInfoElement]'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.managed_by_extended = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.disk_state = None - self.encryption = kwargs.get('encryption', None) - self.max_shares = kwargs.get('max_shares', None) - self.share_info = None - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class DiskAccess(Resource): - """disk access resource. - - 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 private_endpoint_connections: A readonly collection of private endpoint connections - created on the disk. Currently only one endpoint connection is supported. - :vartype private_endpoint_connections: - list[~azure.mgmt.compute.v2020_05_01.models.PrivateEndpointConnection] - :ivar provisioning_state: The disk access resource provisioning state. - :vartype provisioning_state: str - :ivar time_created: The time when the disk access was created. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'time_created': {'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}'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccess, self).__init__(**kwargs) - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None - - -class DiskAccessList(msrest.serialization.Model): - """The List disk access operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with - this to fetch the next page of disk access resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskAccess]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccessList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskAccessUpdate(msrest.serialization.Model): - """Used for updating a disk access resource. - - :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(DiskAccessUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DiskEncryptionSet(Resource): - """disk encryption set resource. - - 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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", - "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'previous_keys': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyVaultAndKeyReference]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSet, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - self.previous_keys = None - self.provisioning_state = None - - -class DiskEncryptionSetList(msrest.serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskEncryptionSetUpdate(msrest.serialization.Model): - """disk encryption set update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", - "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is - used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - - -class DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2020_05_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.max_shares = kwargs.get('max_shares', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class Encryption(msrest.serialization.Model): - """Encryption at rest settings for disk or snapshot. - - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", - "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.type = kwargs.get('type', None) - - -class EncryptionSetIdentity(msrest.serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSetIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_05_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', 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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(msrest.serialization.Model): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private endpoint connection Id. - :vartype id: str - :ivar name: private endpoint connection name. - :vartype name: str - :ivar type: private endpoint connection type. - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: - ~azure.mgmt.compute.v2020_05_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpointConnectionProvisioningState - """ - - _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'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateLinkResource(msrest.serialization.Model): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private link resource Id. - :vartype id: str - :ivar name: private link resource name. - :vartype name: str - :ivar type: private link resource type. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ShareInfoElement(msrest.serialization.Model): - """ShareInfoElement. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. - :vartype vm_uri: str - """ - - _validation = { - 'vm_uri': {'readonly': True}, - } - - _attribute_map = { - 'vm_uri': {'key': 'vmUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareInfoElement, self).__init__(**kwargs) - self.vm_uri = None - - -class Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku - :ivar time_created: The time when the snapshot was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_05_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py index 85a2d73db4bf..73241c8f0bd0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -41,16 +43,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_05_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_05_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2020_05_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2020_05_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -71,6 +73,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2020_05_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2020_05_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -82,12 +96,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -104,6 +118,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -117,31 +139,31 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_05_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager + :vartype create_option: str or ~azure.mgmt.compute.v2020_05_01.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype gallery_image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long + :vartype upload_size_bytes: long """ _validation = { @@ -172,6 +194,30 @@ def __init__( upload_size_bytes: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_05_01.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference + :keyword gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :paramtype gallery_image_reference: ~azure.mgmt.compute.v2020_05_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -196,10 +242,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -224,6 +270,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -245,77 +297,78 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :vartype sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long + :vartype disk_m_bps_read_only: long :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2020_05_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype share_info: list[~azure.mgmt.compute.v2020_05_01.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _validation = { @@ -386,6 +439,61 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.managed_by_extended = None @@ -425,10 +533,10 @@ class DiskAccess(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar private_endpoint_connections: A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. :vartype private_endpoint_connections: @@ -467,6 +575,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccess, self).__init__(location=location, tags=tags, **kwargs) self.private_endpoint_connections = None self.provisioning_state = None @@ -478,11 +592,11 @@ class DiskAccessList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with + :ivar value: Required. A list of disk access resources. + :vartype value: list[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] + :ivar next_link: The uri to fetch the next page of disk access resources. Call ListNext() with this to fetch the next page of disk access resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -501,6 +615,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk access resources. + :paramtype value: list[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] + :keyword next_link: The uri to fetch the next page of disk access resources. Call ListNext() + with this to fetch the next page of disk access resources. + :paramtype next_link: str + """ super(DiskAccessList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -509,8 +630,8 @@ def __init__( class DiskAccessUpdate(msrest.serialization.Model): """Used for updating a disk access resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -523,6 +644,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccessUpdate, self).__init__(**kwargs) self.tags = tags @@ -540,19 +665,19 @@ class DiskEncryptionSet(Resource): :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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference :ivar previous_keys: A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. @@ -593,6 +718,21 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.encryption_type = encryption_type @@ -606,11 +746,11 @@ class DiskEncryptionSetList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -629,6 +769,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ super(DiskEncryptionSetList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -637,15 +784,15 @@ def __init__( class DiskEncryptionSetUpdate(msrest.serialization.Model): """disk encryption set update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType + :ivar active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference + :vartype active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -662,6 +809,17 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType + :keyword active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided + is used to unwrap the encryptionKey. + :paramtype active_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSetUpdate, self).__init__(**kwargs) self.tags = tags self.encryption_type = encryption_type @@ -673,11 +831,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2020_05_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -696,6 +854,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2020_05_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -706,9 +871,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2020_05_01.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_05_01.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -728,6 +893,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_05_01.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -736,47 +906,48 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype disk_m_bps_read_only: long + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _attribute_map = { @@ -813,6 +984,51 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2020_05_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -832,13 +1048,13 @@ def __init__( class Encryption(msrest.serialization.Model): """Encryption at rest settings for disk or snapshot. - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType + :vartype type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType """ _attribute_map = { @@ -853,6 +1069,15 @@ def __init__( type: Optional[Union[str, "EncryptionType"]] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype type: str or ~azure.mgmt.compute.v2020_05_01.models.EncryptionType + """ super(Encryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id self.type = type @@ -863,9 +1088,9 @@ class EncryptionSetIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetIdentityType + :vartype type: str or ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetIdentityType :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity. @@ -893,6 +1118,11 @@ def __init__( type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported. Possible values include: "SystemAssigned". + :paramtype type: str or ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetIdentityType + """ super(EncryptionSetIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -904,18 +1134,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -936,6 +1166,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -945,11 +1189,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -964,6 +1208,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2020_05_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -974,10 +1226,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_05_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2020_05_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -997,6 +1249,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2020_05_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -1007,12 +1265,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -1031,6 +1289,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -1039,10 +1305,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -1057,6 +1323,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -1067,10 +1339,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -1090,6 +1362,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -1100,10 +1378,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -1123,6 +1401,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_05_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -1149,6 +1433,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1164,11 +1450,11 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: private endpoint connection type. :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between DiskAccess and Virtual Network. + :vartype private_link_service_connection_state: ~azure.mgmt.compute.v2020_05_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -1199,6 +1485,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between DiskAccess and Virtual Network. + :paramtype private_link_service_connection_state: + ~azure.mgmt.compute.v2020_05_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.id = None self.name = None @@ -1223,8 +1517,8 @@ class PrivateLinkResource(msrest.serialization.Model): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -1250,6 +1544,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1262,8 +1560,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.compute.v2020_05_01.models.PrivateLinkResource] """ _attribute_map = { @@ -1276,6 +1574,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.compute.v2020_05_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1283,15 +1585,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -1308,6 +1610,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.compute.v2020_05_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1335,6 +1648,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareInfoElement, self).__init__(**kwargs) self.vm_uri = None @@ -1352,50 +1667,51 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku :ivar time_created: The time when the snapshot was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _validation = { @@ -1450,6 +1766,44 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_05_01.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_05_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -1473,11 +1827,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_05_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2020_05_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1496,6 +1850,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2020_05_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1506,9 +1867,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_05_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_05_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -1528,6 +1889,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_05_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1536,29 +1902,30 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _attribute_map = { @@ -1585,6 +1952,33 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2020_05_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_05_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_05_01.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_05_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_05_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1599,8 +1993,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1613,5 +2007,9 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py index 52c73b66c51e..67490c0ff217 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py @@ -5,25 +5,285 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskAccessesOperations(object): """DiskAccessesOperations operations. @@ -49,43 +309,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -103,16 +352,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. @@ -125,15 +376,18 @@ def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_05_01.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +399,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +425,37 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -235,16 +473,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. @@ -257,15 +497,18 @@ def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_05_01.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +520,21 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +546,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.DiskAccess": """Gets information about a disk access resource. :param resource_group_name: The name of the resource group. @@ -336,27 +574,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +598,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> 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 = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,13 +636,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk access resource. :param resource_group_name: The name of the resource group. @@ -434,15 +654,17 @@ def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -456,21 +678,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -482,14 +697,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a resource group. :param resource_group_name: The name of the resource group. @@ -504,35 +720,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -550,16 +762,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -572,34 +785,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -617,18 +825,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def get_private_link_resources( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources possible under disk access resource. :param resource_group_name: The name of the resource group. @@ -647,27 +856,17 @@ def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -681,4 +880,6 @@ def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py index d614048b3c99..73fb1e0e8ac4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskEncryptionSetsOperations(object): """DiskEncryptionSetsOperations operations. @@ -49,43 +274,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -103,16 +317,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. @@ -126,15 +342,19 @@ def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,27 +366,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,47 +392,37 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -236,16 +440,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. @@ -259,15 +465,19 @@ def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +489,21 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,15 +515,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. @@ -338,27 +543,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,41 +567,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> 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 = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,13 +605,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. @@ -436,15 +623,17 @@ def begin_delete( :type disk_encryption_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -458,21 +647,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -484,21 +666,24 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption 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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -506,35 +691,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,21 +733,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -574,34 +758,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -619,6 +798,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py index 5f35c1a06244..cd2573cfb90b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_05_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2020_05_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_05_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-05-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py index 4d7cf1ab04e8..b0a1c3e7b279 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_05_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_05_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_05_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-05-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py index 634071bd8421..6590046874c0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py @@ -6,174 +6,157 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -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 UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -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 - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2020_06_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2020_06_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2020_06_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2020_06_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2020_06_01.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2020_06_01.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2020_06_01.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.v2020_06_01.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2020_06_01.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2020_06_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2020_06_01.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2020_06_01.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2020_06_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineRunCommandsOperations - :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations - :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.v2020_06_01.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2020_06_01.operations.VirtualMachineRunCommandsOperations + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations + operations + :vartype virtual_machine_scale_set_vm_run_commands: + azure.mgmt.compute.v2020_06_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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.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_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_sets = VirtualMachineScaleSetsOperations( - 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 _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.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_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_sets = VirtualMachineScaleSetsOperations(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 _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py index 6b091bdb220b..a5016cfe8a08 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json index dd30d5c82e4c..4a24723cd3b6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py index 4876a9bef368..1bfeb019c55b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py @@ -6,170 +6,159 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -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 UsageOperations -from .operations import VirtualMachinesOperations -from .operations import VirtualMachineSizesOperations -from .operations import ImagesOperations -from .operations import VirtualMachineScaleSetsOperations -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 - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2020_06_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2020_06_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2020_06_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2020_06_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2020_06_01.aio.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2020_06_01.aio.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2020_06_01.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2020_06_01.aio.operations.DedicatedHostsOperations + :vartype dedicated_hosts: + azure.mgmt.compute.v2020_06_01.aio.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2020_06_01.aio.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineImagesOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2020_06_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2020_06_01.aio.operations.ImagesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2020_06_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2020_06_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2020_06_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.v2020_06_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2020_06_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.v2020_06_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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.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_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_sets = VirtualMachineScaleSetsOperations(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) + - 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.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_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_sets = VirtualMachineScaleSetsOperations( - 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 _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py index 391e31bcbf5a..286912602f20 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py index 52e49e6959f3..7b18e72e4b28 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2020_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2020_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2020_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py index ce9ab2496bf1..6b4375caa511 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -246,7 +232,8 @@ async def get( :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. + instance view of the dedicated hosts under the dedicated host group. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -258,29 +245,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -294,8 +270,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -307,8 +286,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -316,35 +297,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -362,11 +339,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -375,8 +354,10 @@ def list_by_subscription( 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.v2020_06_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -384,34 +365,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +405,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py index bd32555120d7..f2c38f59e1ab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -438,7 +417,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -450,30 +430,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -487,8 +456,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -503,8 +475,10 @@ def list_by_host_group( :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.v2020_06_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -512,36 +486,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -559,6 +530,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py index 89e801ec4ead..2a77cb693cce 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2020_06_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2020_06_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py index 6708f769ea48..fe1bd21b7a4e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_06_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py index 8dc951e3af69..a5c63214fbd0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2020_06_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py index 2ef6d4dcfb23..d8ce0e9d9443 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -256,29 +242,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +267,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,8 +279,10 @@ def list_by_subscription( """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.v2020_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -310,34 +290,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,11 +330,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -370,8 +347,10 @@ def list_by_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.v2020_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -379,35 +358,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,6 +400,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py index e27e4fda9a49..a65220cf696a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._ssh_public_keys_operations import build_create_request, build_delete_request, build_generate_key_pair_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -49,8 +55,10 @@ def list_by_subscription( 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.v2020_06_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -58,34 +66,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,11 +106,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -119,8 +124,10 @@ def list_by_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 SshPublicKeysGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -128,35 +135,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,11 +177,13 @@ async def get_next(next_link=None): 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 + @distributed_trace_async async def create( self, resource_group_name: str, @@ -204,32 +209,22 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyResource') - # 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') + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,8 +242,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -274,32 +272,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,8 +301,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -337,25 +328,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,6 +351,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -390,27 +375,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +399,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def generate_key_pair( self, resource_group_name: str, @@ -450,27 +428,17 @@ async def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,4 +452,6 @@ async def generate_key_pair( 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/v2020_06_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_usage_operations.py index ab110199e992..c6f651361eed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2020_06_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py index de02f76ffacb..dff891f122af 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py index edd24243981d..2bc414551586 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2020_06_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_images_operations.py index a59adbdfb466..24dd2f7c1810 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py index 6c2c17f78733..9a2392caa2fc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_by_virtual_machine_request, build_get_request, build_list_by_virtual_machine_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,8 +59,10 @@ def list( :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.v2020_06_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,11 +112,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -135,27 +141,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -169,8 +165,10 @@ async def get( 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, @@ -184,33 +182,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -228,8 +216,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,28 +268,21 @@ async def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,6 +294,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -320,33 +310,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +340,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -382,15 +365,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -403,28 +391,21 @@ async def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,6 +417,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -450,28 +432,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,6 +456,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -501,15 +475,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -524,22 +500,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -551,8 +519,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_by_virtual_machine( self, resource_group_name: str, @@ -581,30 +551,19 @@ async def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -618,8 +577,11 @@ async def get_by_virtual_machine( 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 + + @distributed_trace def list_by_virtual_machine( self, resource_group_name: str, @@ -636,8 +598,10 @@ def list_by_virtual_machine( :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.v2020_06_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -645,38 +609,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +655,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 24449f7dc70a..e070b80ea23d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -193,33 +191,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,18 +248,24 @@ async def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,28 +278,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -314,6 +304,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -328,26 +319,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +362,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +387,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,8 +406,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -457,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -494,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -509,8 +482,10 @@ def list( :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.v2020_06_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -518,36 +493,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -565,6 +537,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 2f872e57269b..44120ab959b5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 24f2e8305e4d..d37ba8eca108 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -124,18 +121,24 @@ async def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,18 +252,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,29 +283,21 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -322,6 +309,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -337,29 +325,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -372,6 +350,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +372,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,23 +398,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,8 +417,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -477,31 +452,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -515,8 +479,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -545,30 +512,19 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -582,4 +538,6 @@ async def list( 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/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index d82a10a88e26..b2296d6068c5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -102,8 +97,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +125,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -265,15 +254,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,29 +281,21 @@ async def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -321,6 +307,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -336,29 +323,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -371,6 +348,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -391,15 +370,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,23 +396,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -443,8 +415,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -476,31 +450,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -514,8 +477,11 @@ async def get( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -535,8 +501,10 @@ def list( :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.v2020_06_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -544,39 +512,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -594,6 +560,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 2f16a2447b3f..1d583d0bae29 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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.v2020_06_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -546,26 +513,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -578,6 +537,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -595,15 +556,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -618,22 +581,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -645,8 +600,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -663,7 +620,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -675,30 +633,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -712,8 +659,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -739,28 +689,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -774,8 +714,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -801,8 +744,10 @@ def list( '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.v2020_06_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -810,42 +755,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -863,6 +805,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -881,28 +824,19 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -915,6 +849,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -939,15 +875,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -963,22 +901,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -990,6 +920,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1004,26 +935,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1036,6 +959,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1053,15 +978,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1076,22 +1003,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1103,6 +1022,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1117,26 +1037,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1149,6 +1061,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1166,15 +1080,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1189,22 +1105,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1216,6 +1124,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1230,26 +1139,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1262,6 +1163,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1280,15 +1183,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1303,22 +1208,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1330,8 +1227,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1363,30 +1262,19 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1400,8 +1288,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1414,26 +1304,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1446,6 +1328,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1463,15 +1347,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1486,22 +1372,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1513,8 +1391,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -1540,26 +1420,18 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1572,6 +1444,7 @@ async def simulate_eviction( 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, @@ -1585,33 +1458,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1627,8 +1490,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1649,15 +1515,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1670,28 +1541,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1703,4 +1567,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py index 208833ec4f1e..aac937a2d386 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_set_orchestration_service_state_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,8 +210,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -241,15 +232,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -306,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -337,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -351,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -399,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -423,27 +405,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -457,8 +429,10 @@ async def get( 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, @@ -471,33 +445,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,6 +476,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -526,18 +494,22 @@ async def begin_deallocate( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,24 +521,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -578,6 +544,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -592,30 +559,22 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -628,6 +587,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -642,18 +603,22 @@ async def begin_delete_instances( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -665,24 +630,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -694,8 +653,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -718,27 +679,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -752,8 +703,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -764,8 +718,10 @@ def list( :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.v2020_06_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -773,35 +729,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -819,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -833,8 +787,10 @@ def list_all( 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.v2020_06_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -842,34 +798,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -887,11 +838,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -906,8 +859,10 @@ def list_skus( :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.v2020_06_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -915,36 +870,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -962,11 +914,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -980,8 +934,10 @@ def get_os_upgrade_history( :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.v2020_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -989,36 +945,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1036,6 +989,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1054,35 +1008,26 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1095,6 +1040,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1116,18 +1063,22 @@ async def begin_power_off( 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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1140,24 +1091,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1169,6 +1114,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1183,33 +1129,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1222,6 +1160,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1236,18 +1176,22 @@ async def begin_restart( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1259,24 +1203,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1288,6 +1226,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1302,33 +1241,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1341,6 +1272,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1355,18 +1288,22 @@ async def begin_start( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1378,24 +1315,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1407,6 +1338,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1421,33 +1353,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1460,6 +1384,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1475,18 +1401,22 @@ async def begin_redeploy( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1498,24 +1428,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1527,6 +1451,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1541,33 +1466,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1580,6 +1497,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1597,18 +1516,22 @@ async def begin_perform_maintenance( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1620,24 +1543,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1649,6 +1566,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1663,30 +1581,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1699,6 +1609,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1713,18 +1625,22 @@ async def begin_update_instances( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,24 +1652,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1765,6 +1675,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1779,33 +1690,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1818,6 +1721,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1834,18 +1739,22 @@ async def begin_reimage( :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.v2020_06_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1857,24 +1766,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1886,6 +1789,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1900,33 +1804,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1939,6 +1835,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -1954,18 +1852,22 @@ async def begin_reimage_all( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1977,24 +1879,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2006,8 +1902,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2035,28 +1933,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2070,8 +1958,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2086,7 +1977,8 @@ async def convert_to_single_placement_group( :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.v2020_06_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2020_06_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 @@ -2097,30 +1989,22 @@ async def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2133,6 +2017,7 @@ async def convert_to_single_placement_group( 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, @@ -2145,30 +2030,22 @@ async def _set_orchestration_service_state_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2181,6 +2058,8 @@ async def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace_async async def begin_set_orchestration_service_state( self, resource_group_name: str, @@ -2198,15 +2077,18 @@ async def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2218,24 +2100,18 @@ async def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2247,4 +2123,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py index 92f776516721..2f93a4ec9966 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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.v2020_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py index b7f0d98500a3..000fc92bcae4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_assess_patches_request_initial, build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_reapply_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2020_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -315,15 +306,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -367,6 +357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +372,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +405,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -443,15 +427,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,27 +452,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,6 +478,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -509,27 +493,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -542,6 +517,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -555,20 +532,21 @@ async def begin_delete( :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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,21 +561,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -609,8 +580,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -624,7 +597,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -636,29 +610,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -672,8 +635,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -696,27 +662,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -730,8 +686,10 @@ async def instance_view( 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, @@ -743,25 +701,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -774,6 +724,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -789,15 +741,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -811,21 +765,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -837,6 +784,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -850,25 +798,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -881,6 +821,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -896,15 +838,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -918,21 +862,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -944,8 +881,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -973,25 +912,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1004,6 +935,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1015,8 +948,10 @@ def list( :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.v2020_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1024,35 +959,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1070,11 +1001,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1087,8 +1020,10 @@ def list_all( 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.v2020_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1096,36 +1031,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1143,11 +1073,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1162,8 +1094,10 @@ def list_available_sizes( :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.v2020_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1171,36 +1105,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1218,6 +1149,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1235,27 +1167,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1268,6 +1191,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1288,15 +1213,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1311,21 +1238,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1337,6 +1257,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1350,27 +1271,17 @@ async def _reapply_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1383,6 +1294,8 @@ async def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace_async async def begin_reapply( self, resource_group_name: str, @@ -1397,15 +1310,17 @@ async def begin_reapply( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1419,21 +1334,14 @@ async def begin_reapply( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1445,6 +1353,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1458,25 +1367,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1489,6 +1390,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1503,15 +1406,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1525,21 +1430,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1551,6 +1449,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1564,25 +1463,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1595,6 +1486,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1609,15 +1502,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1631,21 +1526,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1657,6 +1545,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1670,25 +1559,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1701,6 +1582,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1715,15 +1598,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1737,21 +1622,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1763,6 +1641,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1777,33 +1656,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1816,6 +1687,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1833,15 +1706,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1853,24 +1729,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1882,8 +1752,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1911,29 +1783,18 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1947,8 +1808,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1960,25 +1823,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1991,6 +1846,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -2005,15 +1862,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2027,21 +1886,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2053,8 +1905,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -2077,25 +1931,17 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2108,6 +1954,7 @@ async def simulate_eviction( 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, @@ -2119,27 +1966,17 @@ async def _assess_patches_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2155,8 +1992,11 @@ async def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace_async async def begin_assess_patches( self, resource_group_name: str, @@ -2171,15 +2011,19 @@ async def begin_assess_patches( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2193,24 +2037,17 @@ async def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2222,6 +2059,7 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( @@ -2236,32 +2074,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2277,8 +2105,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -2296,15 +2127,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2316,27 +2152,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2348,4 +2178,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_06_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/__init__.py index d841724b49cd..34d4aa95548e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/__init__.py @@ -6,400 +6,203 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -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 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 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 InstanceViewStatus - from ._models_py3 import KeyVaultKeyReference - from ._models_py3 import KeyVaultSecretReference - from ._models_py3 import LastPatchInstallationSummary - from ._models_py3 import LinuxConfiguration - from ._models_py3 import ListUsagesResult - 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 OSProfile - from ._models_py3 import OrchestrationServiceStateInput - from ._models_py3 import OrchestrationServiceSummary - 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 RetrieveBootDiagnosticsDataResult - 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 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 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 VirtualMachineImageResource - 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 -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 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 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 InstanceViewStatus # 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 ListUsagesResult # 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 OSProfile # type: ignore - from ._models import OrchestrationServiceStateInput # type: ignore - from ._models import OrchestrationServiceSummary # 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 RetrieveBootDiagnosticsDataResult # 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 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 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 VirtualMachineImageResource # 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_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 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 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 InstanceViewStatus +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LastPatchInstallationSummary +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ListUsagesResult +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 OSProfile +from ._models_py3 import OrchestrationServiceStateInput +from ._models_py3 import OrchestrationServiceSummary +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 RetrieveBootDiagnosticsDataResult +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 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 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 VirtualMachineImageResource +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 ._compute_management_client_enums import ( AvailabilitySetSkuTypes, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py index 8858d5c7fd34..03b0f3eaf782 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -34,7 +19,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -45,7 +30,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -56,13 +41,13 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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 @@ -75,7 +60,7 @@ class DiffDiskPlacement(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CACHE_DISK = "CacheDisk" RESOURCE_DISK = "ResourceDisk" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -88,7 +73,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExecutionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Script execution status. """ @@ -100,21 +85,21 @@ class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TIMED_OUT = "TimedOut" CANCELED = "Canceled" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class InGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InGuestPatchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of in-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 @@ -130,7 +115,7 @@ class InGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTOMATIC_BY_OS = "AutomaticByOS" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -139,7 +124,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -148,7 +133,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -157,7 +142,7 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -166,21 +151,21 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class OrchestrationServiceNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. """ @@ -188,14 +173,14 @@ class OrchestrationServiceState(with_metaclass(_CaseInsensitiveEnumMeta, str, En RUNNING = "Running" SUSPENDED = "Suspended" -class OrchestrationServiceStateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrchestrationServiceStateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action to be performed. """ RESUME = "Resume" SUSPEND = "Suspend" -class PatchAssessmentState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PatchAssessmentState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the outcome of an install operation for a given patch. """ @@ -206,7 +191,7 @@ class PatchAssessmentState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PENDING = "Pending" AVAILABLE = "Available" -class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 "Failed", "Succeeded", or "CompletedWithWarnings." @@ -217,7 +202,7 @@ class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -225,7 +210,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -234,7 +219,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class RebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RebootStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reboot status of the machine after the patch operation. It will be in "NotNeeded" status if reboot is not needed after the patch operation. "Required" will be the status once the patch is applied and machine is required to reboot. "Started" will be the reboot status when the machine @@ -248,7 +233,7 @@ class RebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" COMPLETED = "Completed" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -259,14 +244,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -275,7 +260,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -283,7 +268,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SoftwareUpdateRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SoftwareUpdateRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the reboot requirements of the patch. """ @@ -291,7 +276,7 @@ class SoftwareUpdateRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, ALWAYS_REQUIRES_REBOOT = "AlwaysRequiresReboot" CAN_REQUEST_REBOOT = "CanRequestReboot" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -299,7 +284,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. @@ -314,7 +299,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_SSD_LRS = "StandardSSD_LRS" ULTRA_SSD_LRS = "UltraSSD_LRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -326,7 +311,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -334,7 +319,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -343,14 +328,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -360,20 +345,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The @@ -559,7 +544,7 @@ class VirtualMachineSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum STANDARD_NV12 = "Standard_NV12" STANDARD_NV24 = "Standard_NV24" -class VmDiskTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VmDiskTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """VM disk types which are disallowed. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py deleted file mode 100644 index bf5371f12dfa..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py +++ /dev/null @@ -1,8393 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2020_06_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_06_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_06_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2020_06_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2020_06_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, - **kwargs - ): - 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 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 "Failed", "Succeeded", or - "CompletedWithWarnings.". Possible values include: "InProgress", "Failed", "Succeeded", - "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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, - **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.v2020_06_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 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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - 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 - - -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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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.v2020_06_01.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, - } - - def __init__( - self, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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.v2020_06_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.v2020_06_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, - **kwargs - ): - 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 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.v2020_06_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. The list of dedicated host groups. - :type value: list[~azure.mgmt.compute.v2020_06_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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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.v2020_06_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.v2020_06_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, - **kwargs - ): - 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 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.v2020_06_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', None) - - -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.v2020_06_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_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, - **kwargs - ): - 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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_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 HardwareProfile(msrest.serialization.Model): - """Specifies the hardware settings for the virtual machine. - - :param vm_size: Specifies the size of the virtual machine. For more information about virtual - machine sizes, see `Sizes for virtual machines - `_. :code:`
    `:code:`
    ` The - available VM sizes depend on region and availability set. For a list of available sizes use - 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 - `_. - :code:`
    `:code:`
    ` This list of sizes is no longer updated and the - **VirtualMachineSizeTypes** string constants will be removed from the subsequent REST API - specification. Use `List all available virtual machine sizes in a region - `_ to get the latest - sizes. 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.v2020_06_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 source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_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}'}, - '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.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.v2020_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_06_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.v2020_06_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_06_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.v2020_06_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_06_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.v2020_06_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the - image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_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 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.v2020_06_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 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.v2020_06_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.v2020_06_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 "Failed", "Succeeded", or - "CompletedWithWarnings.". Possible values include: "InProgress", "Failed", "Succeeded", - "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.compute.v2020_06_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 reboot_status: The reboot status of the machine after the patch operation. It will be in - "NotNeeded" status if reboot is not needed after the patch operation. "Required" will be the - status once the patch is applied and machine is required to reboot. "Started" will be the - reboot status when the machine has started to reboot. "Failed" will be the status if the - machine is failed to reboot. "Completed" will be the status once the machine is rebooted - successfully. Possible values include: "NotNeeded", "Required", "Started", "Failed", - "Completed". - :vartype reboot_status: str or ~azure.mgmt.compute.v2020_06_01.models.RebootStatus - :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 started_by: The person or system account that started the operation. - :vartype started_by: str - :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.v2020_06_01.models.ApiError - """ - - _validation = { - 'status': {'readonly': True}, - 'installation_activity_id': {'readonly': True}, - 'maintenance_window_exceeded': {'readonly': True}, - 'reboot_status': {'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}, - 'started_by': {'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'}, - 'reboot_status': {'key': 'rebootStatus', 'type': 'str'}, - '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'}, - 'started_by': {'key': 'startedBy', 'type': 'str'}, - '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.reboot_status = 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.started_by = 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.v2020_06_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 - """ - - _attribute_map = { - 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, - 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, - 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, - } - - 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) - - -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.v2020_06_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 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.v2020_06_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.v2020_06_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. 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. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", - "Suspend". - :type action: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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 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.v2020_06_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.v2020_06_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2020_06_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 PatchSettings(msrest.serialization.Model): - """PatchSettings. - - :param patch_mode: Specifies the mode of in-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.v2020_06_01.models.InGuestPatchMode - """ - - _attribute_map = { - 'patch_mode': {'key': 'patchMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchSettings, self).__init__(**kwargs) - self.patch_mode = kwargs.get('patch_mode', 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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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 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 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.v2020_06_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 - """ - - _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'}, - } - - 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) - - -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.v2020_06_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.v2020_06_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.v2020_06_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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. - - :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 - """ - - _attribute_map = { - 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityProfile, self).__init__(**kwargs) - 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.v2020_06_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.v2020_06_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 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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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 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.v2020_06_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.v2020_06_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2020_06_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type automatic_os_upgrade_policy: - ~azure.mgmt.compute.v2020_06_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: An enum describing the unit of usage measurement. Has constant 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.v2020_06_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.v2020_06_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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 - """ - - _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]'}, - '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'}, - } - - 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.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) - - -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.v2020_06_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_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 "Failed", "Succeeded", or - "CompletedWithWarnings.". Possible values include: "InProgress", "Failed", "Succeeded", - "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.compute.v2020_06_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 patches: The list of patches that have been detected as available for installation. - :vartype patches: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_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}, - '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'}, - 'patches': {'key': 'patches', '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.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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_06_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.v2020_06_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.v2020_06_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_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.v2020_06_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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.v2020_06_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.v2020_06_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.v2020_06_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] - """ - - _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}'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineImageResource, self).__init__(**kwargs) - self.name = kwargs['name'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', 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 plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2020_06_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2020_06_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2020_06_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: - ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the - image. - :type disallowed: ~azure.mgmt.compute.v2020_06_01.models.DisallowedConfiguration - """ - - _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}'}, - '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'}, - } - - 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) - - -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.v2020_06_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.v2020_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2020_06_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.InstanceViewStatus] - :param patch_status: The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2020_06_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.v2020_06_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. - - :param available_patch_summary: The available patch summary of the latest assessment operation - for the virtual machine. - :type available_patch_summary: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.LastPatchInstallationSummary - """ - - _attribute_map = { - 'available_patch_summary': {'key': 'availablePatchSummary', 'type': 'AvailablePatchSummary'}, - 'last_patch_installation_summary': {'key': 'lastPatchInstallationSummary', 'type': 'LastPatchInstallationSummary'}, - } - - 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) - - -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.v2020_06_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.ScaleInPolicy - """ - - _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]'}, - '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'}, - } - - 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.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) - - -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.v2020_06_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.v2020_06_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.v2020_06_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_06_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.v2020_06_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_06_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.v2020_06_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.v2020_06_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] - :ivar orchestration_services: The orchestration services information. - :vartype orchestration_services: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2020_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile - """ - - _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'}, - } - - 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) - - -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.v2020_06_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.v2020_06_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: - ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.VirtualMachineScaleSetVMProtectionPolicy - """ - - _validation = { - '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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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: 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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_06_01.models.VirtualMachineExtensionInstanceView - """ - - _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'}, - '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.v2020_06_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.v2020_06_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2020_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2020_06_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_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 = { - 'vm_health': {'readonly': True}, - 'assigned_host': {'readonly': True}, - } - - _attribute_map = { - '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(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 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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2020_06_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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.v2020_06_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile - """ - - _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'}, - } - - 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) - - -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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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 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 kbid: The KBID of the patch. Only applies to Windows patches. - :vartype kbid: 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: - "NeverReboots", "AlwaysRequiresReboot", "CanRequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.compute.v2020_06_01.models.SoftwareUpdateRebootBehavior - :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 outcome of an install operation for a given patch. - Possible values include: "Installed", "Failed", "Excluded", "NotSelected", "Pending", - "Available". - :vartype assessment_state: str or ~azure.mgmt.compute.v2020_06_01.models.PatchAssessmentState - """ - - _validation = { - 'patch_id': {'readonly': True}, - 'name': {'readonly': True}, - 'version': {'readonly': True}, - 'kbid': {'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 = { - 'patch_id': {'key': 'patchId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'kbid': {'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(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) - self.patch_id = None - self.name = None - self.version = None - self.kbid = 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 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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2020_06_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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.v2020_06_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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': '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.v2020_06_01.models.AdditionalUnattendContent] - :param patch_settings: Specifies settings related to in-guest patching (KBs). - :type patch_settings: ~azure.mgmt.compute.v2020_06_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2020_06_01.models.WinRMConfiguration - """ - - _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 WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2020_06_01.models.WinRMListener] - """ - - _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.v2020_06_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2020_06_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py index 0e2e7801bf95..16b50b5cf0ea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py @@ -17,11 +17,11 @@ 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -34,6 +34,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -41,21 +48,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2020_06_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2020_06_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -74,6 +81,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2020_06_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -84,9 +108,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -99,6 +123,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -106,16 +135,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_06_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_06_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2020_06_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2020_06_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -136,6 +165,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2020_06_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2020_06_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -147,12 +188,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -169,6 +210,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -178,16 +227,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -202,6 +251,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -212,9 +273,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -231,6 +292,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -238,15 +304,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -261,6 +327,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -279,10 +356,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -307,6 +384,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -328,25 +411,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2020_06_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.v2020_06_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: + :vartype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :ivar 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.v2020_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ @@ -385,6 +468,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -399,11 +504,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -422,6 +527,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -430,8 +542,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -444,6 +556,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -453,20 +569,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2020_06_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.v2020_06_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :ivar 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.v2020_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ @@ -496,6 +612,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -562,6 +695,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailablePatchSummary, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -576,7 +711,7 @@ def __init__( 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. + :ivar 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 @@ -588,7 +723,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -601,6 +736,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -608,12 +758,12 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar 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 + :vartype storage_uri: str """ _attribute_map = { @@ -628,6 +778,14 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword 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. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -667,6 +825,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -694,6 +854,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -739,6 +901,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -755,44 +919,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2020_06_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :ivar 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.v2020_06_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :ivar 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.v2020_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2020_06_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :ivar 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.v2020_06_01.models.ManagedDiskParameters - :param to_be_detached: Specifies whether the data disk is in process of detachment from the + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype 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. @@ -840,6 +1004,46 @@ def __init__( to_be_detached: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -877,6 +1081,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -894,29 +1100,29 @@ class DedicatedHost(Resource): :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.v2020_06_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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2020_06_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2020_06_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2020_06_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. @@ -967,6 +1173,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2020_06_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -982,11 +1210,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -1001,6 +1229,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -1009,9 +1244,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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.v2020_06_01.models.DedicatedHostAllocatableVM] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1024,6 +1260,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1041,27 +1283,27 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2020_06_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.v2020_06_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1097,6 +1339,24 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1108,8 +1368,8 @@ def __init__( 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.v2020_06_01.models.DedicatedHostInstanceViewWithName] + :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostInstanceViewWithName] """ _attribute_map = { @@ -1122,6 +1382,11 @@ def __init__( hosts: Optional[List["DedicatedHostInstanceViewWithName"]] = None, **kwargs ): + """ + :keyword hosts: List of instance view of the dedicated hosts under the dedicated host group. + :paramtype hosts: + list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostInstanceViewWithName] + """ super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) self.hosts = hosts @@ -1131,11 +1396,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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.v2020_06_01.models.DedicatedHostGroup] - :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1154,6 +1419,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1164,25 +1436,25 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2020_06_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.v2020_06_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1209,6 +1481,22 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1225,10 +1513,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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.v2020_06_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2020_06_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ _validation = { @@ -1248,6 +1537,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2020_06_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -1262,10 +1558,11 @@ class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): :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.v2020_06_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2020_06_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] :ivar name: The name of the dedicated host. :vartype name: str """ @@ -1289,6 +1586,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2020_06_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceViewWithName, self).__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) self.name = None @@ -1298,11 +1602,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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.v2020_06_01.models.DedicatedHost] - :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1321,6 +1625,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1331,24 +1642,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2020_06_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2020_06_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2020_06_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. @@ -1387,6 +1698,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2020_06_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -1401,11 +1729,11 @@ def __init__( 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 + :ivar 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.v2020_06_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2020_06_01.models.BootDiagnostics """ _attribute_map = { @@ -1418,6 +1746,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2020_06_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -1425,10 +1760,10 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2020_06_01.models.DiffDiskOptions - :param placement: Specifies the ephemeral disk placement for operating system + :vartype option: str or ~azure.mgmt.compute.v2020_06_01.models.DiffDiskOptions + :ivar 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:`
    ` @@ -1436,7 +1771,7 @@ class DiffDiskSettings(msrest.serialization.Model): 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.v2020_06_01.models.DiffDiskPlacement + :vartype placement: str or ~azure.mgmt.compute.v2020_06_01.models.DiffDiskPlacement """ _attribute_map = { @@ -1451,6 +1786,20 @@ def __init__( placement: Optional[Union[str, "DiffDiskPlacement"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2020_06_01.models.DiffDiskOptions + :keyword 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". + :paramtype placement: str or ~azure.mgmt.compute.v2020_06_01.models.DiffDiskPlacement + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option self.placement = placement @@ -1459,9 +1808,9 @@ def __init__( 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", + :ivar vm_disk_type: VM disk types which are disallowed. Possible values include: "None", "Unmanaged". - :type vm_disk_type: str or ~azure.mgmt.compute.v2020_06_01.models.VmDiskTypes + :vartype vm_disk_type: str or ~azure.mgmt.compute.v2020_06_01.models.VmDiskTypes """ _attribute_map = { @@ -1474,6 +1823,11 @@ def __init__( vm_disk_type: Optional[Union[str, "VmDiskTypes"]] = None, **kwargs ): + """ + :keyword vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :paramtype vm_disk_type: str or ~azure.mgmt.compute.v2020_06_01.models.VmDiskTypes + """ super(DisallowedConfiguration, self).__init__(**kwargs) self.vm_disk_type = vm_disk_type @@ -1481,8 +1835,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1495,6 +1849,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1502,8 +1860,8 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1516,19 +1874,23 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2020_06_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2020_06_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -1545,6 +1907,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2020_06_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2020_06_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -1554,13 +1925,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2020_06_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -1577,6 +1949,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -1586,7 +1968,7 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """Specifies the hardware settings for the virtual machine. - :param vm_size: Specifies the size of the virtual machine. For more information about virtual + :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines `_. :code:`
    `:code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use @@ -1636,7 +2018,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2020_06_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -1649,6 +2031,59 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual + machine sizes, see `Sizes for virtual machines + `_. :code:`
    `:code:`
    ` The + available VM sizes depend on region and availability set. For a list of available sizes use + 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 + `_. + :code:`
    `:code:`
    ` This list of sizes is no longer updated and the + **VirtualMachineSizeTypes** string constants will be removed from the subsequent REST API + specification. Use `List all available virtual machine sizes in a region + `_ to get the latest + sizes. 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -1666,19 +2101,20 @@ class Image(Resource): :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_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes """ _validation = { @@ -1711,6 +2147,20 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -1721,29 +2171,31 @@ def __init__( class ImageDisk(msrest.serialization.Model): """Describes a image disk. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2020_06_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -1768,6 +2220,33 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + """ super(ImageDisk, self).__init__(**kwargs) self.snapshot = snapshot self.managed_disk = managed_disk @@ -1783,33 +2262,35 @@ class ImageDataDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2020_06_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters - :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype lun: int """ _validation = { @@ -1840,6 +2321,37 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + :keyword 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. + :paramtype lun: int + """ 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 @@ -1849,11 +2361,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2020_06_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1872,6 +2384,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1882,36 +2401,38 @@ class ImageOSDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2020_06_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters - :param os_type: Required. This property allows you to specify the type of the OS that is + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + :ivar 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.v2020_06_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemStateTypes + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemStateTypes """ _validation = { @@ -1945,6 +2466,41 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemStateTypes + """ 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 @@ -1955,21 +2511,21 @@ class ImageReference(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype 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'. @@ -1999,6 +2555,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -2010,19 +2583,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2020_06_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2020_06_01.models.ImageOSDisk + :ivar 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.v2020_06_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -2039,6 +2612,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2020_06_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -2050,17 +2638,18 @@ class ImageUpdate(UpdateResource): 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.v2020_06_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str - :param hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the + :ivar hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes """ _validation = { @@ -2084,6 +2673,18 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.ImageStorageProfile + :keyword hyper_v_generation: Gets the HyperVGenerationType of the VirtualMachine created from + the image. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -2094,10 +2695,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -2112,6 +2713,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -2120,16 +2727,16 @@ def __init__( 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.v2020_06_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2020_06_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -2150,6 +2757,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2020_06_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -2163,10 +2782,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2020_06_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2020_06_01.models.SubResource """ _validation = { @@ -2186,6 +2805,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2020_06_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -2196,10 +2821,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2020_06_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_06_01.models.SubResource """ _validation = { @@ -2219,6 +2844,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_06_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -2308,6 +2939,8 @@ def __init__( self, **kwargs ): + """ + """ super(LastPatchInstallationSummary, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -2327,16 +2960,16 @@ def __init__( 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 + :ivar 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.v2020_06_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2020_06_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool """ _attribute_map = { @@ -2353,6 +2986,18 @@ def __init__( provision_vm_agent: Optional[bool] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2020_06_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -2364,11 +3009,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2020_06_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2387,6 +3032,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2397,23 +3049,23 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -2446,6 +3098,25 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -2478,6 +3149,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -2503,6 +3176,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -2510,23 +3185,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2020_06_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -2551,6 +3226,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2020_06_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -2564,16 +3258,18 @@ def __init__( 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. 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. Possible values include: + :ivar id: Resource Id. + :vartype id: str + :ivar storage_account_type: 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. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -2590,6 +3286,20 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -2598,11 +3308,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -2617,6 +3327,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -2624,9 +3341,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2020_06_01.models.NetworkInterfaceReference] """ @@ -2640,6 +3357,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2020_06_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -2649,12 +3372,12 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_name: Required. The name of the service. Possible values include: + :ivar service_name: Required. The name of the service. Possible values include: "AutomaticRepairs", "DummyOrchestrationServiceName". - :type service_name: str or ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", + :vartype service_name: str or ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceNames + :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". - :type action: str or ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceStateAction + :vartype action: str or ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceStateAction """ _validation = { @@ -2674,6 +3397,16 @@ def __init__( action: Union[str, "OrchestrationServiceStateAction"], **kwargs ): + """ + :keyword service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :paramtype service_name: str or + ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceNames + :keyword action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :paramtype action: str or + ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceStateAction + """ super(OrchestrationServiceStateInput, self).__init__(**kwargs) self.service_name = service_name self.action = action @@ -2706,6 +3439,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrchestrationServiceSummary, self).__init__(**kwargs) self.service_name = None self.service_state = None @@ -2716,48 +3451,48 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2020_06_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :ivar 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.v2020_06_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :ivar 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.v2020_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2020_06_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2020_06_01.models.DiffDiskSettings + :ivar 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.v2020_06_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :ivar 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.v2020_06_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.ManagedDiskParameters """ _validation = { @@ -2794,6 +3529,50 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2020_06_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -2813,9 +3592,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes """ _validation = { @@ -2832,6 +3611,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -2839,30 +3623,29 @@ def __init__( 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. + :ivar 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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -2877,8 +3660,8 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 @@ -2888,29 +3671,28 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration + :ivar 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.v2020_06_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar 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 + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -2939,6 +3721,80 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword 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.**. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -2954,7 +3810,7 @@ def __init__( class PatchSettings(msrest.serialization.Model): """PatchSettings. - :param patch_mode: Specifies the mode of in-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 @@ -2964,7 +3820,7 @@ class PatchSettings(msrest.serialization.Model): **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.v2020_06_01.models.InGuestPatchMode + :vartype patch_mode: str or ~azure.mgmt.compute.v2020_06_01.models.InGuestPatchMode """ _attribute_map = { @@ -2977,6 +3833,19 @@ def __init__( patch_mode: Optional[Union[str, "InGuestPatchMode"]] = None, **kwargs ): + """ + :keyword patch_mode: Specifies the mode of in-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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2020_06_01.models.InGuestPatchMode + """ super(PatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode @@ -2984,15 +3853,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -3011,6 +3880,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3031,15 +3911,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -3053,8 +3933,8 @@ class ProximityPlacementGroup(Resource): placement group. :vartype availability_sets: list[~azure.mgmt.compute.v2020_06_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus """ _validation = { @@ -3089,6 +3969,20 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -3102,10 +3996,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2020_06_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -3124,6 +4018,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3132,8 +4032,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -3146,6 +4046,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -3154,13 +4058,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -3183,6 +4087,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -3215,6 +4128,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -3225,26 +4140,26 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool + :ivar 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.v2020_06_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2020_06_01.models.IntervalInMins """ _validation = { @@ -3280,6 +4195,28 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2020_06_01.models.IntervalInMins + """ 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 @@ -3309,6 +4246,8 @@ def __init__( self, **kwargs ): + """ + """ super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -3344,6 +4283,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -3353,26 +4294,26 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str """ _validation = { @@ -3397,6 +4338,28 @@ def __init__( pause_time_between_batches: Optional[str] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -3438,6 +4401,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -3480,6 +4445,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -3500,10 +4467,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -3545,6 +4512,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -3557,17 +4530,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_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 + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -3596,6 +4569,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -3609,21 +4595,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandParameterDefinition] """ _validation = { @@ -3657,6 +4643,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -3667,13 +4671,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2020_06_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] """ _validation = { @@ -3694,6 +4698,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -3705,10 +4718,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -3728,6 +4741,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -3738,11 +4757,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2020_06_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3761,6 +4780,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3771,14 +4797,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -3802,6 +4828,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -3812,8 +4848,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -3826,6 +4862,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -3833,7 +4873,7 @@ def __init__( 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. + :ivar 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 @@ -3847,7 +4887,7 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetScaleInRules] """ @@ -3861,6 +4901,24 @@ def __init__( rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetScaleInRules] + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules @@ -3868,9 +4926,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2020_06_01.models.TerminateNotificationProfile """ @@ -3884,6 +4942,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2020_06_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -3891,12 +4955,12 @@ def __init__( class SecurityProfile(msrest.serialization.Model): """Specifies the Security profile settings for the virtual machine or virtual machine scale set. - :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. + :ivar 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 + :vartype encryption_at_host: bool """ _attribute_map = { @@ -3909,6 +4973,14 @@ def __init__( encryption_at_host: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype encryption_at_host: bool + """ super(SecurityProfile, self).__init__(**kwargs) self.encryption_at_host = encryption_at_host @@ -3916,14 +4988,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -3940,6 +5012,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -3949,8 +5031,8 @@ def __init__( 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.v2020_06_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2020_06_01.models.SshPublicKey] """ _attribute_map = { @@ -3963,6 +5045,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2020_06_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -3970,15 +5056,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -3993,6 +5079,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -4003,16 +5100,16 @@ class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): 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 + :ivar 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 + :vartype private_key: str + :ivar 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 + :vartype public_key: str + :ivar id: Required. The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - :type id: str + :vartype id: str """ _validation = { @@ -4035,6 +5132,18 @@ def __init__( id: str, **kwargs ): + """ + :keyword 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. + :paramtype private_key: str + :keyword 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. + :paramtype public_key: str + :keyword id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :paramtype id: str + """ super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) self.private_key = private_key self.public_key = public_key @@ -4054,15 +5163,15 @@ class SshPublicKeyResource(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _validation = { @@ -4089,6 +5198,17 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyResource, self).__init__(location=location, tags=tags, **kwargs) self.public_key = public_key @@ -4098,11 +5218,11 @@ class SshPublicKeysGroupListResult(msrest.serialization.Model): 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.v2020_06_01.models.SshPublicKeyResource] - :param next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + :ivar value: Required. The list of SSH public keys. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeyResource] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4121,6 +5241,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of SSH public keys. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeyResource] + :keyword 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. + :paramtype next_link: str + """ super(SshPublicKeysGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4129,13 +5256,13 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _attribute_map = { @@ -4150,6 +5277,15 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyUpdateResource, self).__init__(tags=tags, **kwargs) self.public_key = public_key @@ -4157,21 +5293,21 @@ def __init__( 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 + :ivar 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.v2020_06_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2020_06_01.models.ImageReference + :ivar 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.v2020_06_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2020_06_01.models.OSDisk + :ivar 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.v2020_06_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.DataDisk] """ _attribute_map = { @@ -4188,6 +5324,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2020_06_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2020_06_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -4215,6 +5368,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -4222,11 +5377,11 @@ def __init__( class SubResourceWithColocationStatus(SubResource): """SubResourceWithColocationStatus. - :param id: Resource Id. - :type id: str - :param colocation_status: Describes colocation status of a resource in the Proximity Placement + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus + :vartype colocation_status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus """ _attribute_map = { @@ -4241,6 +5396,13 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword colocation_status: Describes colocation status of a resource in the Proximity + Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus + """ super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) self.colocation_status = colocation_status @@ -4248,13 +5410,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -4269,6 +5431,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -4279,23 +5450,23 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -4328,6 +5499,25 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ 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) @@ -4361,6 +5551,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -4409,6 +5601,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -4448,6 +5642,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -4457,19 +5653,19 @@ def __init__( 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.v2020_06_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2020_06_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.AutomaticOSUpgradePolicy """ @@ -4487,6 +5683,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2020_06_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2020_06_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -4502,12 +5714,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2020_06_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2020_06_01.models.UsageName """ _validation = { @@ -4534,6 +5746,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2020_06_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -4543,10 +5763,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -4561,6 +5781,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -4591,6 +5817,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -4599,21 +5827,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -4628,6 +5856,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -4636,12 +5881,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2020_06_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2020_06_01.models.VaultCertificate] """ _attribute_map = { @@ -4656,6 +5901,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2020_06_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -4664,8 +5917,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -4678,6 +5931,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -4695,41 +5952,41 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2020_06_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :ivar 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.v2020_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :ivar 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 @@ -4742,46 +5999,45 @@ class VirtualMachine(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.v2020_06_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 + :vartype availability_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_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.v2020_06_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2020_06_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.v2020_06_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. + :vartype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -4791,15 +6047,15 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str """ _validation = { @@ -4872,6 +6128,105 @@ def __init__( extensions_time_budget: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -4902,13 +6257,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -4925,6 +6280,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -4989,6 +6353,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -5005,13 +6371,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -5034,6 +6400,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -5045,8 +6420,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -5078,6 +6453,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -5098,36 +6477,37 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2020_06_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -5172,6 +6552,37 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -5188,12 +6599,12 @@ def __init__( 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.v2020_06_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus """ _attribute_map = { @@ -5210,6 +6621,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -5229,23 +6648,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -5280,6 +6699,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -5291,16 +6729,16 @@ def __init__( 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.v2020_06_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5321,6 +6759,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -5332,8 +6782,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -5346,6 +6796,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -5353,29 +6807,29 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -5404,6 +6858,31 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -5436,6 +6915,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -5451,15 +6932,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2020_06_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2020_06_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_06_01.models.UserAssignedIdentitiesValue] """ @@ -5482,6 +6963,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2020_06_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2020_06_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -5494,16 +6987,16 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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] + :vartype tags: dict[str, str] """ _validation = { @@ -5527,6 +7020,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -5538,32 +7043,33 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2020_06_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2020_06_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2020_06_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2020_06_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2020_06_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2020_06_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2020_06_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes + :ivar disallowed: Specifies disallowed configuration for the VirtualMachine created from the image. - :type disallowed: ~azure.mgmt.compute.v2020_06_01.models.DisallowedConfiguration + :vartype disallowed: ~azure.mgmt.compute.v2020_06_01.models.DisallowedConfiguration """ _validation = { @@ -5599,6 +7105,36 @@ def __init__( disallowed: Optional["DisallowedConfiguration"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2020_06_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2020_06_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2020_06_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2020_06_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationTypes + :keyword disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :paramtype disallowed: ~azure.mgmt.compute.v2020_06_01.models.DisallowedConfiguration + """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, **kwargs) self.plan = plan self.os_disk_image = os_disk_image @@ -5613,47 +7149,47 @@ class VirtualMachineInstanceView(msrest.serialization.Model): 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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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.v2020_06_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.v2020_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2020_06_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2020_06_01.models.BootDiagnosticsInstanceView + :vartype boot_diagnostics: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.InstanceViewStatus] - :param patch_status: The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePatchStatus + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar patch_status: The status of virtual machine patch operations. + :vartype patch_status: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePatchStatus """ _validation = { @@ -5699,6 +7235,43 @@ def __init__( patch_status: Optional["VirtualMachinePatchStatus"] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_06_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2020_06_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2020_06_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :keyword patch_status: The status of virtual machine patch operations. + :paramtype patch_status: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePatchStatus + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -5723,11 +7296,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2020_06_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5746,6 +7319,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5754,12 +7334,12 @@ def __init__( class VirtualMachinePatchStatus(msrest.serialization.Model): """The status of virtual machine patch operations. - :param available_patch_summary: The available patch summary of the latest assessment operation + :ivar available_patch_summary: The available patch summary of the latest assessment operation for the virtual machine. - :type available_patch_summary: ~azure.mgmt.compute.v2020_06_01.models.AvailablePatchSummary - :param last_patch_installation_summary: The installation summary of the latest installation + :vartype available_patch_summary: ~azure.mgmt.compute.v2020_06_01.models.AvailablePatchSummary + :ivar last_patch_installation_summary: The installation summary of the latest installation operation for the virtual machine. - :type last_patch_installation_summary: + :vartype last_patch_installation_summary: ~azure.mgmt.compute.v2020_06_01.models.LastPatchInstallationSummary """ @@ -5775,6 +7355,16 @@ def __init__( last_patch_installation_summary: Optional["LastPatchInstallationSummary"] = None, **kwargs ): + """ + :keyword available_patch_summary: The available patch summary of the latest assessment + operation for the virtual machine. + :paramtype available_patch_summary: + ~azure.mgmt.compute.v2020_06_01.models.AvailablePatchSummary + :keyword last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :paramtype last_patch_installation_summary: + ~azure.mgmt.compute.v2020_06_01.models.LastPatchInstallationSummary + """ super(VirtualMachinePatchStatus, self).__init__(**kwargs) self.available_patch_summary = available_patch_summary self.last_patch_installation_summary = last_patch_installation_summary @@ -5783,9 +7373,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -5798,6 +7388,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -5815,33 +7410,33 @@ class VirtualMachineRunCommand(Resource): :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.v2020_06_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -5893,6 +7488,35 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -5910,23 +7534,23 @@ def __init__( 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", + :ivar execution_state: Script execution status. Possible values include: "Unknown", "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". - :type execution_state: str or ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.InstanceViewStatus] + :vartype execution_state: str or ~azure.mgmt.compute.v2020_06_01.models.ExecutionState + :ivar execution_message: Communicate script configuration errors or execution messages. + :vartype execution_message: str + :ivar exit_code: Exit code returned from script execution. + :vartype exit_code: int + :ivar output: Script output stream. + :vartype output: str + :ivar error: Script error stream. + :vartype error: str + :ivar start_time: Script start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Script end time. + :vartype end_time: ~datetime.datetime + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5953,6 +7577,25 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword execution_state: Script execution status. Possible values include: "Unknown", + "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :paramtype execution_state: str or ~azure.mgmt.compute.v2020_06_01.models.ExecutionState + :keyword execution_message: Communicate script configuration errors or execution messages. + :paramtype execution_message: str + :keyword exit_code: Exit code returned from script execution. + :paramtype exit_code: int + :keyword output: Script output stream. + :paramtype output: str + :keyword error: Script error stream. + :paramtype error: str + :keyword start_time: Script start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Script end time. + :paramtype end_time: ~datetime.datetime + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) self.execution_state = execution_state self.execution_message = execution_message @@ -5967,12 +7610,12 @@ def __init__( 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 + :ivar script: Specifies the script content to be executed on the VM. + :vartype script: str + :ivar script_uri: Specifies the script download location. + :vartype script_uri: str + :ivar command_id: Specifies a commandId of predefined built-in script. + :vartype command_id: str """ _attribute_map = { @@ -5989,6 +7632,14 @@ def __init__( command_id: Optional[str] = None, **kwargs ): + """ + :keyword script: Specifies the script content to be executed on the VM. + :paramtype script: str + :keyword script_uri: Specifies the script download location. + :paramtype script_uri: str + :keyword command_id: Specifies a commandId of predefined built-in script. + :paramtype command_id: str + """ super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) self.script = script self.script_uri = script_uri @@ -6000,10 +7651,10 @@ class VirtualMachineRunCommandsListResult(msrest.serialization.Model): 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.v2020_06_01.models.VirtualMachineRunCommand] - :param next_link: The uri to fetch the next page of run commands. - :type next_link: str + :ivar value: Required. The list of run commands. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + :ivar next_link: The uri to fetch the next page of run commands. + :vartype next_link: str """ _validation = { @@ -6022,6 +7673,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of run commands. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] + :keyword next_link: The uri to fetch the next page of run commands. + :paramtype next_link: str + """ super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6032,31 +7689,31 @@ class VirtualMachineRunCommandUpdate(UpdateResource): 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.v2020_06_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -6099,6 +7756,33 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2020_06_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -6126,65 +7810,65 @@ class VirtualMachineScaleSet(Resource): :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.v2020_06_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :ivar 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.v2020_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_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 upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2020_06_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar 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 + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2020_06_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.v2020_06_01.models.SubResource - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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. + :vartype host_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :ivar 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.v2020_06_01.models.ScaleInPolicy + :vartype scale_in_policy: ~azure.mgmt.compute.v2020_06_01.models.ScaleInPolicy """ _validation = { @@ -6245,6 +7929,65 @@ def __init__( scale_in_policy: Optional["ScaleInPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2020_06_01.models.ScaleInPolicy + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -6271,39 +8014,39 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2020_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetManagedDiskParameters - :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + :ivar 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. + :vartype disk_iops_read_write: long + :ivar 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 + :vartype disk_m_bps_read_write: long """ _validation = { @@ -6337,6 +8080,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword 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. + :paramtype disk_iops_read_write: long + :keyword 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. + :paramtype disk_m_bps_read_write: long + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -6356,37 +8134,37 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -6426,6 +8204,35 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.type = None @@ -6446,11 +8253,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2020_06_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6469,6 +8276,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6477,13 +8291,14 @@ def __init__( 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.v2020_06_01.models.VirtualMachineScaleSetExtension] - :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype extensions_time_budget: str """ _attribute_map = { @@ -6498,6 +8313,16 @@ def __init__( extensions_time_budget: Optional[str] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype extensions_time_budget: str + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions self.extensions_time_budget = extensions_time_budget @@ -6514,33 +8339,33 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -6580,6 +8405,33 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -6606,17 +8458,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2020_06_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: + :vartype type: str or ~azure.mgmt.compute.v2020_06_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -6639,6 +8490,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2020_06_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -6671,6 +8536,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6687,8 +8554,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] :ivar orchestration_services: The orchestration services information. :vartype orchestration_services: list[~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceSummary] @@ -6713,6 +8580,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -6742,6 +8613,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -6751,39 +8624,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2020_06_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2020_06_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2020_06_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :ivar 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: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :ivar 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. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.SubResource] """ _validation = { @@ -6818,6 +8692,44 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2020_06_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -6833,10 +8745,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -6851,6 +8763,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -6861,11 +8779,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2020_06_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2020_06_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6884,6 +8803,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2020_06_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6894,11 +8821,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2020_06_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6917,6 +8844,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6927,11 +8861,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2020_06_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6950,6 +8884,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6960,11 +8901,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2020_06_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6983,6 +8924,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6991,13 +8939,15 @@ def __init__( 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: + :ivar 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". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -7012,6 +8962,17 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_06_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_06_01.models.DiskEncryptionSetParameters + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -7022,28 +8983,28 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar 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.v2020_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -7076,6 +9037,30 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -7090,8 +9075,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -7104,6 +9089,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -7111,12 +9100,12 @@ def __init__( 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 + :ivar 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.v2020_06_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -7132,6 +9121,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -7142,43 +9140,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2020_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2020_06_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :ivar 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.v2020_06_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2020_06_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2020_06_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -7214,6 +9212,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_06_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2020_06_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -7230,25 +9268,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -7263,27 +9300,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration + :ivar 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.v2020_06_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.v2020_06_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] """ _attribute_map = { @@ -7308,6 +9345,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -7323,21 +9416,21 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2020_06_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_01.models.IPVersion + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2020_06_01.models.IPVersion """ _validation = { @@ -7364,6 +9457,23 @@ def __init__( public_ip_address_version: Optional[Union[str, "IPVersion"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2020_06_01.models.IPVersion + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -7378,10 +9488,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -7398,6 +9508,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -7405,9 +9521,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -7420,19 +9536,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -7447,6 +9568,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -7480,6 +9610,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -7521,6 +9653,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -7531,21 +9665,22 @@ def __init__( 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 + :ivar 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.v2020_06_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2020_06_01.models.ImageReference + :ivar 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.v2020_06_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2020_06_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -7562,6 +9697,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2020_06_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -7571,45 +9724,45 @@ def __init__( 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.v2020_06_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2020_06_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2020_06_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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.v2020_06_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :ivar 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.v2020_06_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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2020_06_01.models.ScaleInPolicy + :ivar 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.v2020_06_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource """ _attribute_map = { @@ -7646,6 +9799,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2020_06_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2020_06_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_06_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2020_06_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -7664,34 +9860,34 @@ def __init__( 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.v2020_06_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2020_06_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2020_06_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.SubResource] """ _attribute_map = { @@ -7722,6 +9918,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2020_06_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2020_06_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -7737,27 +9965,27 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar 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.v2020_06_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -7786,6 +10014,29 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -7800,12 +10051,12 @@ def __init__( 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 + :ivar 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.v2020_06_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -7821,6 +10072,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -7829,23 +10089,23 @@ def __init__( 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.v2020_06_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2020_06_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: + :vartype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -7869,6 +10129,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2020_06_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2020_06_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -7881,14 +10161,14 @@ def __init__( 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.v2020_06_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] """ _attribute_map = { @@ -7907,6 +10187,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2020_06_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -7917,12 +10207,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -7940,6 +10230,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -7949,12 +10248,13 @@ def __init__( 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.v2020_06_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2020_06_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -7971,6 +10271,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2020_06_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -7980,28 +10289,30 @@ def __init__( 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.v2020_06_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar security_profile: The virtual machine scale set Security profile. + :vartype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2020_06_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. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar 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.v2020_06_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -8030,6 +10341,32 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword security_profile: The virtual machine scale set Security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -8055,20 +10392,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2020_06_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2020_06_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -8081,29 +10418,29 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile + :ivar 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.v2020_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: + :vartype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :ivar 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 @@ -8113,10 +10450,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2020_06_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2020_06_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 + :ivar 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: @@ -8126,12 +10463,12 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMProtectionPolicy """ @@ -8199,6 +10536,66 @@ def __init__( protection_policy: Optional["VirtualMachineScaleSetVMProtectionPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMProtectionPolicy + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -8234,32 +10631,33 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2020_06_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -8299,6 +10697,33 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) self.name = None self.type = None @@ -8317,8 +10742,8 @@ def __init__( 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.v2020_06_01.models.VirtualMachineScaleSetVMExtension] + :ivar value: The list of VMSS VM extensions. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] """ _attribute_map = { @@ -8331,6 +10756,11 @@ def __init__( value: Optional[List["VirtualMachineScaleSetVMExtension"]] = None, **kwargs ): + """ + :keyword value: The list of VMSS VM extensions. + :paramtype value: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] + """ super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -8361,6 +10791,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -8377,28 +10809,28 @@ class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _validation = { @@ -8434,6 +10866,30 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -8450,10 +10906,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -8466,6 +10922,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -8475,8 +10937,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -8493,6 +10955,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -8502,39 +10968,39 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2020_06_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2020_06_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2020_06_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2020_06_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_06_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 + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -8572,6 +11038,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2020_06_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2020_06_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2020_06_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -8592,11 +11086,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8615,6 +11109,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8623,8 +11124,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -8638,6 +11139,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -8645,27 +11151,27 @@ def __init__( 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.v2020_06_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :ivar security_profile: Specifies the Security related profile settings for the virtual machines in the scale set. - :type security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -8675,24 +11181,25 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :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. + :vartype license_type: str + :ivar 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.v2020_06_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype priority: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :ivar 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.v2020_06_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -8725,6 +11232,57 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetNetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :paramtype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionProfile + :keyword 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. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2020_06_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -8742,13 +11300,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -8763,6 +11321,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -8771,20 +11338,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -8807,6 +11374,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -8819,8 +11402,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSize] """ _attribute_map = { @@ -8833,6 +11416,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -8899,6 +11486,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -8937,6 +11526,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -8947,37 +11538,37 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2020_06_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :ivar 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.v2020_06_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :ivar 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 @@ -8990,46 +11581,45 @@ class VirtualMachineUpdate(UpdateResource): 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.v2020_06_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 + :vartype availability_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_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.v2020_06_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2020_06_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.v2020_06_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. + :vartype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :ivar 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.v2020_06_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2020_06_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.v2020_06_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -9039,15 +11629,15 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str """ _validation = { @@ -9109,6 +11699,103 @@ def __init__( extensions_time_budget: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_06_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2020_06_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_06_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_06_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2020_06_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2020_06_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2020_06_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_06_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2020_06_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_06_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2020_06_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -9138,11 +11825,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -9155,6 +11842,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -9162,30 +11856,30 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". + :vartype enable_automatic_updates: bool + :ivar 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 + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2020_06_01.models.AdditionalUnattendContent] - :param patch_settings: Specifies settings related to in-guest patching (KBs). - :type patch_settings: ~azure.mgmt.compute.v2020_06_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :ivar patch_settings: Specifies settings related to in-guest patching (KBs). + :vartype patch_settings: ~azure.mgmt.compute.v2020_06_01.models.PatchSettings + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2020_06_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2020_06_01.models.WinRMConfiguration """ _attribute_map = { @@ -9208,6 +11902,32 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword 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 + `_. + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2020_06_01.models.AdditionalUnattendContent] + :keyword patch_settings: Specifies settings related to in-guest patching (KBs). + :paramtype patch_settings: ~azure.mgmt.compute.v2020_06_01.models.PatchSettings + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2020_06_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -9220,8 +11940,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2020_06_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2020_06_01.models.WinRMListener] """ _attribute_map = { @@ -9234,6 +11954,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2020_06_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -9241,18 +11965,18 @@ def __init__( 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 + :ivar 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.v2020_06_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2020_06_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -9267,6 +11991,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2020_06_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py index eb909335cc21..8b21bf90405d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2020_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2020_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py index 8c821ecbf0b6..9877ba2d88e1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +296,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +359,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +388,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +415,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,14 +438,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -254,7 +454,8 @@ def get( :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. + instance view of the dedicated hosts under the dedicated host group. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -266,29 +467,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,22 +492,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -325,35 +519,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -371,22 +561,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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.v2020_06_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -394,34 +587,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +627,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py index 3363fd6cfd34..a89eff61598a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2020_06_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2020_06_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHost" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -449,7 +616,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -461,30 +629,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -498,15 +655,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -515,8 +674,10 @@ def list_by_host_group( :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.v2020_06_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -524,36 +685,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py index 832464e8c3ad..a71c2659572a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_06_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py index bc9f7cb5034d..6f9e59a13663 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_06_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py index 9c78af266ec3..7465524e7f1f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2020_06_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py index 50e6caaf16fe..fccb59f53333 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = _SERIALIZER.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +294,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +327,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +357,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +386,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +413,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,14 +436,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -264,29 +464,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,18 +489,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2020_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -319,34 +512,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,24 +552,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -389,35 +580,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +622,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py index 85bd6bffcb51..df4287c1564f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py @@ -5,23 +5,277 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_key_pair_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SshPublicKeysOperations(object): """SshPublicKeysOperations operations. @@ -45,17 +299,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + **kwargs: Any + ) -> 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.v2020_06_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -63,34 +319,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,25 +359,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -134,35 +388,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,19 +430,20 @@ def get_next(next_link=None): 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 + @distributed_trace def create( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -211,32 +462,22 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyResource') + + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,16 +495,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyUpdateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyUpdateResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -282,32 +525,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -321,15 +554,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> None: """Delete an SSH public key. :param resource_group_name: The name of the resource group. @@ -346,25 +581,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,13 +604,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Retrieves information about an SSH public key. :param resource_group_name: The name of the resource group. @@ -400,27 +628,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,15 +652,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def generate_key_pair( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyGenerateKeyPairResult" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_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. @@ -461,27 +681,17 @@ def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,4 +705,6 @@ def generate_key_pair( 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/v2020_06_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_usage_operations.py index 968d695d7f5c..ca2e5a90a7d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py index e9aed02e09f5..463523ced3cd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2020_06_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extensions_operations.py index 63a5d66d2d76..31ea441e8759 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2020_06_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_images_operations.py index 751c14ad1eaa..9fa8b4fd7765 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2020_06_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py index 6634509217ec..c722616ba11d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py @@ -5,25 +5,305 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -47,19 +327,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -67,35 +349,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,18 +391,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -141,27 +420,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,49 +444,40 @@ def get( 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -235,17 +495,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the run command. :param resource_group_name: The name of the resource group. @@ -259,15 +521,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +547,21 @@ def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,49 +573,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -369,17 +619,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the run command. :param resource_group_name: The name of the resource group. @@ -392,15 +644,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -413,28 +670,21 @@ def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,43 +696,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,14 +735,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - run_command_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the run command. :param resource_group_name: The name of the resource group. @@ -513,15 +754,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -536,22 +779,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -563,17 +798,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the run command. :param resource_group_name: The name of the resource group. @@ -594,30 +830,19 @@ def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -631,16 +856,18 @@ def get_by_virtual_machine( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineRunCommandsListResult"]: """The operation to get all run commands of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -650,8 +877,10 @@ def list_by_virtual_machine( :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.v2020_06_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -659,38 +888,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -708,6 +934,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py index 72e81e321d65..febc4213f3db 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +320,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +350,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +376,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to update an extension. :param resource_group_name: The name of the resource group. @@ -265,18 +449,24 @@ def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -289,28 +479,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -322,41 +505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +544,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -387,15 +563,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +588,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,17 +607,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -468,30 +639,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +665,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -521,8 +683,10 @@ def list( :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.v2020_06_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -530,36 +694,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -577,6 +738,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 2d4e05b480ed..1b58d892b05f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 5ba4a653fa7a..8c0e80b9bc01 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,24 +5,246 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMExtensionsOperations(object): """VirtualMachineScaleSetVMExtensionsOperations operations. @@ -48,47 +270,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,18 +317,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -130,18 +343,24 @@ def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +374,21 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +400,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +448,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -271,18 +474,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +505,21 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -330,45 +531,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,15 +572,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -402,15 +594,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,23 +620,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,18 +639,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMExtension": """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -488,31 +674,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,17 +701,19 @@ def get( 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 + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_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. @@ -557,30 +734,19 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,4 +760,6 @@ def list( 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/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 4fee9e7bcfe2..d2dc7cd43cba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,25 +5,247 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMRunCommandsOperations(object): """VirtualMachineScaleSetVMRunCommandsOperations operations. @@ -49,47 +271,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -107,18 +318,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -133,15 +346,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +373,21 @@ def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +399,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +447,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -273,15 +475,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,29 +502,21 @@ def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -329,45 +528,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,15 +569,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -401,15 +591,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +617,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -453,18 +636,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -487,31 +671,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -525,17 +698,19 @@ def get( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -547,8 +722,10 @@ def list( :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.v2020_06_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -556,39 +733,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +781,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py index f3faf84c944e..2e8412fec06e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,611 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +635,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +678,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +697,22 @@ def begin_reimage( :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.v2020_06_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +725,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +748,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +787,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +807,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +832,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +851,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +890,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +911,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +936,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +955,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +1005,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +1031,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +1057,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,41 +1083,33 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,14 +1122,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -609,15 +1141,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -632,22 +1166,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -659,17 +1185,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -678,7 +1205,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -690,30 +1218,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -727,16 +1244,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -755,28 +1274,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -790,18 +1299,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -818,8 +1329,10 @@ def list( '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.v2020_06_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -827,42 +1340,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -880,6 +1390,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -887,40 +1398,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -933,15 +1434,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -958,15 +1460,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -982,22 +1486,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1009,41 +1505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1056,14 +1544,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1074,15 +1563,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1097,22 +1588,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1124,41 +1607,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1171,14 +1646,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1189,15 +1665,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1212,22 +1690,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1239,41 +1709,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1286,14 +1748,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1305,15 +1768,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1328,22 +1793,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1355,17 +1812,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_models.RetrieveBootDiagnosticsDataResult": """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. @@ -1389,30 +1847,19 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1426,41 +1873,34 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1473,14 +1913,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1491,15 +1932,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1514,22 +1957,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1541,16 +1976,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -1569,26 +2005,18 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1601,47 +2029,37 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1657,17 +2075,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1680,15 +2100,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2020_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1701,28 +2125,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1734,4 +2151,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py index 2cff92ba30f0..14142d7206d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,894 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_set_orchestration_service_state_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -49,43 +918,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +961,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -123,15 +983,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +1008,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +1034,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,16 +1078,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -249,15 +1100,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +1125,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,39 +1151,31 @@ def get_long_running_output(pipeline_response): ) 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 - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,13 +1188,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -361,15 +1204,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +1228,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -409,15 +1247,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -434,27 +1273,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,48 +1297,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,14 +1344,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -539,18 +1362,22 @@ def begin_deallocate( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,24 +1389,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,45 +1412,37 @@ def get_long_running_output(pipeline_response): ) 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" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2020-06-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] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -642,14 +1455,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace def begin_delete_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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -657,18 +1471,22 @@ def begin_delete_instances( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -680,24 +1498,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -709,15 +1521,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -734,27 +1547,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -768,21 +1571,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -790,35 +1597,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,23 +1639,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2020_06_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -860,34 +1666,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,18 +1706,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -925,8 +1727,10 @@ def list_skus( :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.v2020_06_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -934,36 +1738,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -981,18 +1782,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1000,8 +1802,10 @@ def get_os_upgrade_history( :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.v2020_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1009,36 +1813,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1056,6 +1857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1063,47 +1865,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1116,15 +1908,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1138,18 +1931,22 @@ def begin_power_off( 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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1162,24 +1959,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1191,48 +1982,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1245,14 +2028,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1260,18 +2044,22 @@ def begin_restart( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1283,24 +2071,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1312,48 +2094,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1366,14 +2140,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1381,18 +2156,22 @@ def begin_start( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1404,24 +2183,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1433,48 +2206,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1487,14 +2252,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1503,18 +2269,22 @@ def begin_redeploy( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1526,24 +2296,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1555,48 +2319,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1609,14 +2365,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1627,18 +2384,22 @@ def begin_perform_maintenance( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1650,24 +2411,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1679,45 +2434,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1730,14 +2477,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1745,18 +2493,22 @@ def begin_update_instances( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1768,24 +2520,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1797,48 +2543,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1851,14 +2589,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1868,18 +2607,22 @@ def begin_reimage( :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.v2020_06_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1891,24 +2634,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1920,48 +2657,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1974,14 +2703,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1990,18 +2720,22 @@ def begin_reimage_all( :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2013,24 +2747,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2042,16 +2770,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2072,28 +2801,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2107,16 +2826,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2124,7 +2845,8 @@ def convert_to_single_placement_group( :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.v2020_06_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2020_06_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 @@ -2135,30 +2857,22 @@ def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2171,43 +2885,35 @@ def convert_to_single_placement_group( 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2220,14 +2926,15 @@ def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. @@ -2238,15 +2945,18 @@ def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2258,24 +2968,18 @@ def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2287,4 +2991,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_06_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_sizes_operations.py index 6551a76d2873..5813ab07306d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py index 9435a2025086..11a4aebdcaeb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py @@ -5,25 +5,863 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_assess_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +885,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +907,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +949,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +957,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +998,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +1021,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +1046,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +1072,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +1120,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. @@ -324,15 +1143,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2020_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -344,27 +1167,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,47 +1193,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -434,16 +1241,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -454,15 +1263,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2020_06_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,27 +1287,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -506,42 +1313,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -554,34 +1352,36 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -596,21 +1396,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -622,23 +1415,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -650,29 +1445,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -686,15 +1470,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -711,27 +1497,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -745,39 +1521,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -790,13 +1559,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -806,15 +1576,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -828,21 +1600,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -854,39 +1619,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -899,13 +1656,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -915,15 +1673,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -937,21 +1697,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -963,15 +1716,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 @@ -993,25 +1747,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1024,20 +1770,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1045,35 +1794,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1091,17 +1836,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - status_only=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + status_only: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -1109,8 +1855,10 @@ def list_all( 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.v2020_06_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1118,36 +1866,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1165,18 +1908,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1185,8 +1929,10 @@ def list_available_sizes( :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.v2020_06_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1194,36 +1940,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1241,6 +1984,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1248,38 +1992,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1292,14 +2026,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1313,15 +2048,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1336,21 +2073,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1362,41 +2092,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1409,13 +2129,14 @@ def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace def begin_reapply( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to reapply a virtual machine's state. :param resource_group_name: The name of the resource group. @@ -1424,15 +2145,17 @@ def begin_reapply( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1446,21 +2169,14 @@ def begin_reapply( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1472,39 +2188,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1517,13 +2225,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1532,15 +2241,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1554,21 +2265,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1580,39 +2284,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1625,13 +2321,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1640,15 +2337,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1662,21 +2361,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1688,39 +2380,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1733,13 +2417,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1748,15 +2433,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1770,21 +2457,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1796,48 +2476,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1850,14 +2522,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1868,15 +2541,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1888,24 +2564,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1917,16 +2587,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_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. @@ -1947,29 +2618,18 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1983,39 +2643,32 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2028,13 +2681,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -2043,15 +2697,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2065,21 +2721,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2091,15 +2740,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """The operation to simulate the eviction of spot virtual machine. :param resource_group_name: The name of the resource group. @@ -2116,25 +2766,17 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2147,39 +2789,29 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-06-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2195,15 +2827,17 @@ def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace def begin_assess_patches( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineAssessPatchesResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineAssessPatchesResult"]: """Assess patches on the VM. :param resource_group_name: The name of the resource group. @@ -2212,15 +2846,19 @@ def begin_assess_patches( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_06_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2234,24 +2872,17 @@ def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2263,47 +2894,37 @@ def get_long_running_output(pipeline_response): ) 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 _run_command_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.RunCommandInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RunCommandResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2020-06-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2319,16 +2940,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2339,15 +2962,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_06_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2020_06_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2359,27 +2986,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2391,4 +3012,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py index ad8c6138da00..e5be43023750 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -34,61 +29,66 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_06_30.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_06_30.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_06_30.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_06_30.operations.DiskAccessesOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py index 83fb17fdd16f..bdd03597c3f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json index e9eef9ecb7a3..c22618f21a56 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "disks": "DisksOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py index 392851d69c12..6f99c6609a2f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DisksOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -32,59 +29,66 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_06_30.aio.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_06_30.aio.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_06_30.aio.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_06_30.aio.operations.DiskAccessesOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py index 4b28d8960669..4abf311f1620 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py index cb8cf1ee1bf9..f1d96d564f82 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_accesses_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_private_link_resources_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_06_30.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_06_30.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -423,15 +397,17 @@ async def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -445,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -471,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -484,7 +455,8 @@ def list_by_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 DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -492,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -538,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -551,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -559,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,11 +570,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace_async async def get_private_link_resources( self, resource_group_name: str, @@ -633,27 +601,17 @@ async def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -667,4 +625,6 @@ async def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py index 809758b24318..f0ee76a8b21d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_associated_resources_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,20 @@ async def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore async def _update_initial( @@ -186,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,8 +293,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -329,27 +321,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -363,8 +345,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -376,27 +360,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,6 +383,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -425,15 +401,17 @@ async def begin_delete( :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -447,21 +425,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,8 +444,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +458,10 @@ def list_by_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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -494,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -552,8 +525,10 @@ def list( """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -561,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, resource_group_name: str, @@ -627,7 +599,8 @@ def list_associated_resources( :type disk_encryption_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 ResourceUriList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.ResourceUriList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] @@ -635,36 +608,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,6 +652,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py index 0209791c5d06..a38b66abd610 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_06_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2020_06_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_06_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py index d07e7f4deceb..c565c0c824e4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_06_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_06_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_06_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/__init__.py index 48e3cd444b99..224ec0c0219e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/__init__.py @@ -6,80 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import CreationData - from ._models_py3 import Disk - from ._models_py3 import DiskAccess - from ._models_py3 import DiskAccessList - from ._models_py3 import DiskAccessUpdate - from ._models_py3 import DiskEncryptionSet - from ._models_py3 import DiskEncryptionSetList - from ._models_py3 import DiskEncryptionSetUpdate - from ._models_py3 import DiskList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import Encryption - from ._models_py3 import EncryptionSetIdentity - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import GrantAccessData - from ._models_py3 import ImageDiskReference - from ._models_py3 import InnerError - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import Resource - from ._models_py3 import ResourceUriList - from ._models_py3 import ShareInfoElement - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - from ._models import ApiError # type: ignore - from ._models import ApiErrorBase # type: ignore - from ._models import CreationData # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskAccess # type: ignore - from ._models import DiskAccessList # type: ignore - from ._models import DiskAccessUpdate # type: ignore - from ._models import DiskEncryptionSet # type: ignore - from ._models import DiskEncryptionSetList # type: ignore - from ._models import DiskEncryptionSetUpdate # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionSetIdentity # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import ImageDiskReference # type: ignore - from ._models import InnerError # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceUriList # type: ignore - from ._models import ShareInfoElement # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore +from ._models_py3 import AccessUri +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import CreationData +from ._models_py3 import Disk +from ._models_py3 import DiskAccess +from ._models_py3 import DiskAccessList +from ._models_py3 import DiskAccessUpdate +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import GrantAccessData +from ._models_py3 import ImageDiskReference +from ._models_py3 import InnerError +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceUriList +from ._models_py3 import ShareInfoElement +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_compute_management_client_enums.py index 81536b84fd93..56c11da4bb87 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -55,13 +40,13 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the disk. UPLOAD = "Upload" -class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. """ SYSTEM_ASSIGNED = "SystemAssigned" -class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -72,7 +57,7 @@ class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: of the keys is Customer managed and the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible state of the disk. """ @@ -89,7 +74,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -104,7 +89,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: databases (for example, SQL, Oracle), and other transaction-heavy workloads. ULTRA_SSD_LRS = "UltraSSD_LRS" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -118,14 +103,14 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAccessPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for accessing the disk via network. """ @@ -136,14 +121,14 @@ class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The disk cannot be exported. DENY_ALL = "DenyAll" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -152,7 +137,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -160,7 +145,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_models.py deleted file mode 100644 index b35541f7b433..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_models.py +++ /dev/null @@ -1,1519 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -class ApiError(msrest.serialization.Model): - """Api error. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_06_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_06_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_06_30.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the - ImageDiskReference will be the ARM id of the shared galley image version from which to create a - disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are - 512 ad 4096. 4096 is the default. - :type logical_sector_size: int - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'gallery_image_reference': {'key': 'galleryImageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - 'logical_sector_size': {'key': 'logicalSectorSize', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.gallery_image_reference = kwargs.get('gallery_image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', None) - self.logical_sector_size = kwargs.get('logical_sector_size', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the - disk attached. maxShares should be set to a value greater than one for disks to allow attaching - them to multiple VMs. - :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2020_06_30.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should - be set to a value greater than one for disks to allow attaching them to multiple VMs. - :vartype share_info: list[~azure.mgmt.compute.v2020_06_30.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'managed_by_extended': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'share_info': {'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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'managed_by_extended': {'key': 'managedByExtended', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'share_info': {'key': 'properties.shareInfo', 'type': '[ShareInfoElement]'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.managed_by_extended = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.disk_state = None - self.encryption = kwargs.get('encryption', None) - self.max_shares = kwargs.get('max_shares', None) - self.share_info = None - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - - -class DiskAccess(Resource): - """disk access resource. - - 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 private_endpoint_connections: A readonly collection of private endpoint connections - created on the disk. Currently only one endpoint connection is supported. - :vartype private_endpoint_connections: - list[~azure.mgmt.compute.v2020_06_30.models.PrivateEndpointConnection] - :ivar provisioning_state: The disk access resource provisioning state. - :vartype provisioning_state: str - :ivar time_created: The time when the disk access was created. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'time_created': {'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}'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccess, self).__init__(**kwargs) - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None - - -class DiskAccessList(msrest.serialization.Model): - """The List disk access operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with - this to fetch the next page of disk access resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskAccess]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccessList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskAccessUpdate(msrest.serialization.Model): - """Used for updating a disk access resource. - - :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(DiskAccessUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DiskEncryptionSet(Resource): - """disk encryption set resource. - - 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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'previous_keys': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyVaultAndKeyReference]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSet, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - self.previous_keys = None - self.provisioning_state = None - - -class DiskEncryptionSetList(msrest.serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskEncryptionSetUpdate(msrest.serialization.Model): - """disk encryption set update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is - used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - - -class DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2020_06_30.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.max_shares = kwargs.get('max_shares', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - - -class Encryption(msrest.serialization.Model): - """Encryption at rest settings for disk or snapshot. - - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", - "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_06_30.models.EncryptionType - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.type = kwargs.get('type', None) - - -class EncryptionSetIdentity(msrest.serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSetIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_06_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', 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 KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(msrest.serialization.Model): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private endpoint connection Id. - :vartype id: str - :ivar name: private endpoint connection name. - :vartype name: str - :ivar type: private endpoint connection type. - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: - ~azure.mgmt.compute.v2020_06_30.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpointConnectionProvisioningState - """ - - _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'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateLinkResource(msrest.serialization.Model): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private link resource Id. - :vartype id: str - :ivar name: private link resource name. - :vartype name: str - :ivar type: private link resource type. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ResourceUriList(msrest.serialization.Model): - """The List resources which are encrypted with the disk encryption set. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the - disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with - this to fetch the next page of encrypted resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUriList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ShareInfoElement(msrest.serialization.Model): - """ShareInfoElement. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. - :vartype vm_uri: str - """ - - _validation = { - 'vm_uri': {'readonly': True}, - } - - _attribute_map = { - 'vm_uri': {'key': 'vmUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareInfoElement, self).__init__(**kwargs) - self.vm_uri = None - - -class Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku - :ivar time_created: The time when the snapshot was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2020_06_30.models.DiskState - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_06_30.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_models_py3.py index 791ce85eb47a..4b11c6c8295f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -41,16 +43,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_06_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_06_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2020_06_30.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2020_06_30.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -71,6 +73,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2020_06_30.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2020_06_30.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -82,12 +96,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -104,6 +118,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -117,34 +139,34 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_06_30.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager + :vartype create_option: str or ~azure.mgmt.compute.v2020_06_30.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype gallery_image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are + :vartype upload_size_bytes: long + :ivar logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default. - :type logical_sector_size: int + :vartype logical_sector_size: int """ _validation = { @@ -177,6 +199,33 @@ def __init__( logical_sector_size: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_06_30.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference + :keyword gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :paramtype gallery_image_reference: ~azure.mgmt.compute.v2020_06_30.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + :keyword logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values + are 512 ad 4096. 4096 is the default. + :paramtype logical_sector_size: int + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -202,10 +251,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -230,6 +279,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -251,81 +306,82 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] + :vartype sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long + :vartype disk_m_bps_read_only: long :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2020_06_30.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype share_info: list[~azure.mgmt.compute.v2020_06_30.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str + :vartype tier: str """ _validation = { @@ -398,6 +454,65 @@ def __init__( tier: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.managed_by_extended = None @@ -438,10 +553,10 @@ class DiskAccess(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar private_endpoint_connections: A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. :vartype private_endpoint_connections: @@ -480,6 +595,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccess, self).__init__(location=location, tags=tags, **kwargs) self.private_endpoint_connections = None self.provisioning_state = None @@ -491,11 +612,11 @@ class DiskAccessList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with + :ivar value: Required. A list of disk access resources. + :vartype value: list[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] + :ivar next_link: The uri to fetch the next page of disk access resources. Call ListNext() with this to fetch the next page of disk access resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -514,6 +635,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk access resources. + :paramtype value: list[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] + :keyword next_link: The uri to fetch the next page of disk access resources. Call ListNext() + with this to fetch the next page of disk access resources. + :paramtype next_link: str + """ super(DiskAccessList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -522,8 +650,8 @@ def __init__( class DiskAccessUpdate(msrest.serialization.Model): """Used for updating a disk access resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -536,6 +664,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccessUpdate, self).__init__(**kwargs) self.tags = tags @@ -553,18 +685,18 @@ class DiskEncryptionSet(Resource): :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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference :ivar previous_keys: A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. @@ -605,6 +737,20 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.encryption_type = encryption_type @@ -618,11 +764,11 @@ class DiskEncryptionSetList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -641,6 +787,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ super(DiskEncryptionSetList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -649,14 +802,14 @@ def __init__( class DiskEncryptionSetUpdate(msrest.serialization.Model): """disk encryption set update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType + :ivar active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - :type active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference + :vartype active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -673,6 +826,16 @@ def __init__( active_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetType + :keyword active_key: Key Vault Key Url and vault id of KeK, KeK is optional and when provided + is used to unwrap the encryptionKey. + :paramtype active_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference + """ super(DiskEncryptionSetUpdate, self).__init__(**kwargs) self.tags = tags self.encryption_type = encryption_type @@ -684,11 +847,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2020_06_30.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -707,6 +870,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2020_06_30.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -717,9 +887,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2020_06_30.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_06_30.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -739,6 +909,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_06_30.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -747,51 +922,52 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype disk_m_bps_read_only: long + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str + :vartype tier: str """ _attribute_map = { @@ -830,6 +1006,55 @@ def __init__( tier: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2020_06_30.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -850,13 +1075,13 @@ def __init__( class Encryption(msrest.serialization.Model): """Encryption at rest settings for disk or snapshot. - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_06_30.models.EncryptionType + :vartype type: str or ~azure.mgmt.compute.v2020_06_30.models.EncryptionType """ _attribute_map = { @@ -871,6 +1096,15 @@ def __init__( type: Optional[Union[str, "EncryptionType"]] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype type: str or ~azure.mgmt.compute.v2020_06_30.models.EncryptionType + """ super(Encryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id self.type = type @@ -881,9 +1115,9 @@ class EncryptionSetIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetIdentityType + :vartype type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetIdentityType :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity. @@ -911,6 +1145,11 @@ def __init__( type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported. Possible values include: "SystemAssigned". + :paramtype type: str or ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetIdentityType + """ super(EncryptionSetIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -922,18 +1161,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -954,6 +1193,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -963,11 +1216,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -982,6 +1235,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2020_06_30.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -992,10 +1253,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_06_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2020_06_30.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -1015,6 +1276,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2020_06_30.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -1025,12 +1292,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -1049,6 +1316,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -1057,10 +1332,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -1075,6 +1350,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -1085,10 +1366,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -1108,6 +1389,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -1118,10 +1405,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -1141,6 +1428,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_06_30.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -1167,6 +1460,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1182,11 +1477,11 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: private endpoint connection type. :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between DiskAccess and Virtual Network. + :vartype private_link_service_connection_state: ~azure.mgmt.compute.v2020_06_30.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -1217,6 +1512,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between DiskAccess and Virtual Network. + :paramtype private_link_service_connection_state: + ~azure.mgmt.compute.v2020_06_30.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.id = None self.name = None @@ -1241,8 +1544,8 @@ class PrivateLinkResource(msrest.serialization.Model): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -1268,6 +1571,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1280,8 +1587,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.compute.v2020_06_30.models.PrivateLinkResource] """ _attribute_map = { @@ -1294,6 +1601,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.compute.v2020_06_30.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1301,15 +1612,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -1326,6 +1637,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.compute.v2020_06_30.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1337,12 +1659,12 @@ class ResourceUriList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + :ivar value: Required. A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + :vartype value: list[str] + :ivar next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1361,6 +1683,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + disk encryption set. + :paramtype value: list[str] + :keyword next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + this to fetch the next page of encrypted resources. + :paramtype next_link: str + """ super(ResourceUriList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1387,6 +1717,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareInfoElement, self).__init__(**kwargs) self.vm_uri = None @@ -1404,29 +1736,29 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku :ivar time_created: The time when the snapshot was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", @@ -1434,23 +1766,24 @@ class Snapshot(Resource): :vartype disk_state: str or ~azure.mgmt.compute.v2020_06_30.models.DiskState :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _validation = { @@ -1507,6 +1840,44 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_06_30.models.HyperVGeneration + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_06_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -1531,11 +1902,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_06_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2020_06_30.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1554,6 +1925,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2020_06_30.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1564,9 +1942,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_06_30.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_06_30.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -1586,6 +1964,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_06_30.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1594,29 +1977,30 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - :type sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :vartype sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _attribute_map = { @@ -1643,6 +2027,33 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2020_06_30.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_06_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_06_30.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_06_30.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_06_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1657,8 +2068,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1671,5 +2082,9 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py index 73e9bdfb38a9..dca985c66f4c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py @@ -5,25 +5,285 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskAccessesOperations(object): """DiskAccessesOperations operations. @@ -49,43 +309,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -103,16 +352,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. @@ -125,15 +376,18 @@ def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_06_30.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +399,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +425,37 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -235,16 +473,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. @@ -257,15 +497,18 @@ def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_06_30.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +520,21 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +546,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.DiskAccess": """Gets information about a disk access resource. :param resource_group_name: The name of the resource group. @@ -336,27 +574,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +598,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> 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 = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,13 +636,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk access resource. :param resource_group_name: The name of the resource group. @@ -434,15 +654,17 @@ def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -456,21 +678,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -482,14 +697,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a resource group. :param resource_group_name: The name of the resource group. @@ -504,35 +720,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -550,16 +762,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -572,34 +785,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -617,18 +825,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def get_private_link_resources( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources possible under disk access resource. :param resource_group_name: The name of the resource group. @@ -647,27 +856,17 @@ def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -681,4 +880,6 @@ def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py index d280a3bcf08f..a9ed452d0e74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py @@ -5,25 +5,285 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_associated_resources_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskEncryptionSetsOperations(object): """DiskEncryptionSetsOperations operations. @@ -49,43 +309,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -103,16 +352,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. @@ -126,15 +377,19 @@ def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,27 +401,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,47 +427,37 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -236,16 +475,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. @@ -259,15 +500,19 @@ def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +524,21 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,15 +550,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. @@ -338,27 +578,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,41 +602,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> 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 = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,13 +640,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. @@ -436,15 +658,17 @@ def begin_delete( :type disk_encryption_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -458,21 +682,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -484,21 +701,24 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption 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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -506,35 +726,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,21 +768,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -574,34 +793,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -619,18 +833,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceUriList"] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceUriList"]: """Lists all resources that are encrypted with this disk encryption set. :param resource_group_name: The name of the resource group. @@ -649,36 +864,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -696,6 +908,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py index d110406af3d7..7da9fc61a63c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_06_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2020_06_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-06-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_06_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-06-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py index 18fed5043ae6..c9b67d22455e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_06_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_06_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-06-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_06_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-06-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py index c90eab499ed2..0c189f6f3ee5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py @@ -6,37 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, GallerySharingProfileOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .operations import DiskRestorePointOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import GallerySharingProfileOperations -from .operations import SharedGalleriesOperations -from .operations import SharedGalleryImagesOperations -from .operations import SharedGalleryImageVersionsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -44,101 +29,103 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_09_30.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_09_30.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_09_30.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_09_30.operations.DiskAccessesOperations :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.v2020_09_30.operations.DiskRestorePointOperations + :vartype disk_restore_point: + azure.mgmt.compute.v2020_09_30.operations.DiskRestorePointOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2020_09_30.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2020_09_30.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2020_09_30.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2020_09_30.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2020_09_30.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2020_09_30.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2020_09_30.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2020_09_30.operations.GalleryApplicationVersionsOperations :ivar gallery_sharing_profile: GallerySharingProfileOperations operations - :vartype gallery_sharing_profile: azure.mgmt.compute.v2020_09_30.operations.GallerySharingProfileOperations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2020_09_30.operations.GallerySharingProfileOperations :ivar shared_galleries: SharedGalleriesOperations operations :vartype shared_galleries: azure.mgmt.compute.v2020_09_30.operations.SharedGalleriesOperations :ivar shared_gallery_images: SharedGalleryImagesOperations operations - :vartype shared_gallery_images: azure.mgmt.compute.v2020_09_30.operations.SharedGalleryImagesOperations + :vartype shared_gallery_images: + azure.mgmt.compute.v2020_09_30.operations.SharedGalleryImagesOperations :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations - :vartype shared_gallery_image_versions: azure.mgmt.compute.v2020_09_30.operations.SharedGalleryImageVersionsOperations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2020_09_30.operations.SharedGalleryImageVersionsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( - self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_sharing_profile = GallerySharingProfileOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_galleries = SharedGalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_images = SharedGalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_sharing_profile = GallerySharingProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_images = SharedGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py index a667b75946b6..80f17d9a926a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json index 9d20ccdb058c..bd6f0d35f3a7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "disks": "DisksOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py index 6f67a5f00e37..7d341a44343f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py @@ -6,35 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, GallerySharingProfileOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SnapshotsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .operations import DiskRestorePointOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import GallerySharingProfileOperations -from .operations import SharedGalleriesOperations -from .operations import SharedGalleryImagesOperations -from .operations import SharedGalleryImageVersionsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -42,99 +29,104 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_09_30.aio.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_09_30.aio.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_09_30.aio.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_09_30.aio.operations.DiskAccessesOperations :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.v2020_09_30.aio.operations.DiskRestorePointOperations + :vartype disk_restore_point: + azure.mgmt.compute.v2020_09_30.aio.operations.DiskRestorePointOperations :ivar galleries: GalleriesOperations operations :vartype galleries: azure.mgmt.compute.v2020_09_30.aio.operations.GalleriesOperations :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2020_09_30.aio.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2020_09_30.aio.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2020_09_30.aio.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2020_09_30.aio.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2020_09_30.aio.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2020_09_30.aio.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2020_09_30.aio.operations.GalleryApplicationVersionsOperations :ivar gallery_sharing_profile: GallerySharingProfileOperations operations - :vartype gallery_sharing_profile: azure.mgmt.compute.v2020_09_30.aio.operations.GallerySharingProfileOperations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2020_09_30.aio.operations.GallerySharingProfileOperations :ivar shared_galleries: SharedGalleriesOperations operations - :vartype shared_galleries: azure.mgmt.compute.v2020_09_30.aio.operations.SharedGalleriesOperations + :vartype shared_galleries: + azure.mgmt.compute.v2020_09_30.aio.operations.SharedGalleriesOperations :ivar shared_gallery_images: SharedGalleryImagesOperations operations - :vartype shared_gallery_images: azure.mgmt.compute.v2020_09_30.aio.operations.SharedGalleryImagesOperations + :vartype shared_gallery_images: + azure.mgmt.compute.v2020_09_30.aio.operations.SharedGalleryImagesOperations :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations - :vartype shared_gallery_image_versions: azure.mgmt.compute.v2020_09_30.aio.operations.SharedGalleryImageVersionsOperations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2020_09_30.aio.operations.SharedGalleryImageVersionsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_sharing_profile = GallerySharingProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_images = SharedGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( - self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_sharing_profile = GallerySharingProfileOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_galleries = SharedGalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_images = SharedGalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py index 13cf1d7831eb..87ddc35fcbab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py index 0df730ce63c2..becdc53fb54b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_accesses_operations import build_create_or_update_request_initial, build_delete_a_private_endpoint_connection_request_initial, build_delete_request_initial, build_get_a_private_endpoint_connection_request, build_get_private_link_resources_request, build_get_request, build_list_by_resource_group_request, build_list_private_endpoint_connections_request, build_list_request, build_update_a_private_endpoint_connection_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_09_30.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_09_30.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -423,15 +397,17 @@ async def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -445,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -471,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -484,7 +455,8 @@ def list_by_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 DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -492,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -538,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -551,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -559,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,11 +570,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace_async async def get_private_link_resources( self, resource_group_name: str, @@ -633,27 +601,17 @@ async def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -667,8 +625,10 @@ async def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + async def _update_a_private_endpoint_connection_initial( self, resource_group_name: str, @@ -682,33 +642,23 @@ async def _update_a_private_endpoint_connection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - # 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') + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - 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 @@ -726,8 +676,11 @@ async def _update_a_private_endpoint_connection_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_update_a_private_endpoint_connection( self, resource_group_name: str, @@ -749,18 +702,24 @@ async def begin_update_a_private_endpoint_connection( :type private_endpoint_connection_name: str :param private_endpoint_connection: private endpoint connection object supplied in the body of the Put private endpoint connection operation. - :type private_endpoint_connection: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -773,28 +732,21 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -806,8 +758,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace_async async def get_a_private_endpoint_connection( self, resource_group_name: str, @@ -835,28 +789,18 @@ async def get_a_private_endpoint_connection( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get_a_private_endpoint_connection.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -870,8 +814,10 @@ async def get_a_private_endpoint_connection( return cls(pipeline_response, deserialized, {}) return deserialized + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _delete_a_private_endpoint_connection_initial( self, resource_group_name: str, @@ -884,28 +830,18 @@ async def _delete_a_private_endpoint_connection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -918,6 +854,8 @@ async def _delete_a_private_endpoint_connection_initial( _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete_a_private_endpoint_connection( self, resource_group_name: str, @@ -937,15 +875,17 @@ async def begin_delete_a_private_endpoint_connection( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -960,22 +900,14 @@ async def begin_delete_a_private_endpoint_connection( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -987,8 +919,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_private_endpoint_connections( self, resource_group_name: str, @@ -1004,8 +938,10 @@ def list_private_endpoint_connections( are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -1013,36 +949,33 @@ def list_private_endpoint_connections( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_private_endpoint_connections.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1060,6 +993,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py index 7425b1a9b07c..faf55954826f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_associated_resources_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,20 @@ async def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore async def _update_initial( @@ -186,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,8 +293,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -329,27 +321,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -363,8 +345,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -376,27 +360,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,6 +383,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -425,15 +401,17 @@ async def begin_delete( :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -447,21 +425,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,8 +444,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +458,10 @@ def list_by_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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -494,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -552,8 +525,10 @@ def list( """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -561,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, resource_group_name: str, @@ -627,7 +599,8 @@ def list_associated_resources( :type disk_encryption_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 ResourceUriList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.ResourceUriList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] @@ -635,36 +608,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,6 +652,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py index 8873593f8d75..93f647173eab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_restore_point_operations import build_get_request, build_list_by_restore_point_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,29 +80,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,8 +106,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + @distributed_trace def list_by_restore_point( self, resource_group_name: str, @@ -132,8 +131,10 @@ def list_by_restore_point( 80 characters. :type vm_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskRestorePointList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePointList] + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] @@ -141,37 +142,35 @@ def list_by_restore_point( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_restore_point.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, '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) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskRestorePointList', pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -189,6 +188,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py index 50e1aaca6560..33eb4ac6fe3c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_09_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2020_09_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py index 98f9d9ba248d..84b14333c87b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._galleries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'Gallery') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,19 @@ async def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2020_09_30.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore async def _update_initial( @@ -187,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -226,8 +213,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -246,15 +236,19 @@ async def begin_update( :type gallery: ~azure.mgmt.compute.v2020_09_30.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -266,27 +260,21 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -298,8 +286,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -325,29 +315,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + select=select, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +340,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +355,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,6 +378,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +394,17 @@ async def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +418,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +437,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +452,8 @@ def list_by_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 GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -490,35 +461,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +503,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +518,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -557,34 +527,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +567,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py index 1d88a3775f6f..9e7220b0029a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_application_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_application_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -133,18 +131,24 @@ async def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +162,21 @@ async def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +188,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +205,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -249,8 +236,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -277,18 +267,24 @@ async def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +298,21 @@ async def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +324,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -372,31 +362,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,8 +389,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -425,29 +406,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -460,6 +431,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -483,15 +456,17 @@ async def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -507,23 +482,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -535,8 +501,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, resource_group_name: str, @@ -555,8 +523,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -564,37 +534,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,6 +580,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py index fe8750aad984..f9bdaead362c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -129,15 +127,20 @@ async def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +153,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +179,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore async def _update_initial( @@ -198,33 +195,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -238,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,15 +253,20 @@ async def begin_update( :type gallery_application: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +279,21 @@ async def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,8 +305,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -346,28 +336,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -381,8 +361,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -395,28 +377,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -429,6 +401,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -447,15 +421,17 @@ async def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -470,22 +446,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -497,8 +465,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -513,8 +483,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -522,36 +494,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -569,6 +538,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py index 42f955c42ff3..4da0ba29f8ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_image_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_image_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -136,15 +134,20 @@ async def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +161,21 @@ async def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +187,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +204,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -249,8 +235,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -280,15 +269,20 @@ async def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +296,21 @@ async def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +322,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -371,31 +359,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,8 +386,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -424,29 +403,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -459,6 +428,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -481,15 +452,17 @@ async def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -505,23 +478,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -533,8 +497,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, resource_group_name: str, @@ -553,8 +519,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -562,37 +530,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py index 4142105c0c45..c4151ddd0b82 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -128,15 +126,19 @@ async def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +151,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -182,6 +177,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore async def _update_initial( @@ -197,33 +193,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -237,8 +223,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -262,15 +251,19 @@ async def begin_update( :type gallery_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +276,21 @@ async def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,8 +302,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -344,28 +332,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -379,8 +357,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -393,28 +373,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -427,6 +397,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -445,15 +417,17 @@ async def begin_delete( :type gallery_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -468,22 +442,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -512,7 +480,8 @@ def list_by_gallery( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] @@ -520,36 +489,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -567,6 +533,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py index 4350acac21c2..8a5632388a74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_sharing_profile_operations import build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,32 +58,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(sharing_update, 'SharingUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sharing_update, 'SharingUpdate') - 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 @@ -97,8 +91,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -116,15 +113,20 @@ async def begin_update( :type sharing_update: ~azure.mgmt.compute.v2020_09_30.models.SharingUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SharingUpdate or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: + :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 SharingUpdate or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.SharingUpdate] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -136,27 +138,21 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, sharing_update=sharing_update, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SharingUpdate', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -168,4 +164,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py index 845fd4276560..7b14bb5ba815 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shared_galleries_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -56,7 +62,8 @@ def list( :type shared_to: str or ~azure.mgmt.compute.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] @@ -64,37 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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'), - 'location': self._serialize.url("location", location, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryList', pipeline_response) + deserialized = self._deserialize("SharedGalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,11 +115,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -139,27 +144,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -173,4 +168,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py index 2b5cda0429cb..fb2e4f1b9fe6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shared_gallery_image_versions_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -62,8 +68,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersionList] + :return: An iterator like instance of either SharedGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] @@ -71,39 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,11 +127,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -158,29 +166,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -194,4 +192,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py index d78f1b550fb3..8e8467cf7faf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shared_gallery_images_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -58,8 +64,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageList] + :return: An iterator like instance of either SharedGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] @@ -67,38 +75,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,11 +121,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -147,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -182,4 +179,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py index 74570ef42999..d83091027329 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_09_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_09_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py index e7d7c4a1c3f1..525c5bbca1ca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/__init__.py @@ -6,200 +6,103 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import CreationData - from ._models_py3 import DataDiskImageEncryption - from ._models_py3 import Disallowed - from ._models_py3 import Disk - from ._models_py3 import DiskAccess - from ._models_py3 import DiskAccessList - from ._models_py3 import DiskAccessUpdate - from ._models_py3 import DiskEncryptionSet - from ._models_py3 import DiskEncryptionSetList - from ._models_py3 import DiskEncryptionSetUpdate - from ._models_py3 import DiskImageEncryption - from ._models_py3 import DiskList - from ._models_py3 import DiskRestorePoint - from ._models_py3 import DiskRestorePointList - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import Encryption - from ._models_py3 import EncryptionImages - from ._models_py3 import EncryptionSetIdentity - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import ExtendedLocation - from ._models_py3 import Gallery - from ._models_py3 import GalleryApplication - from ._models_py3 import GalleryApplicationList - from ._models_py3 import GalleryApplicationUpdate - from ._models_py3 import GalleryApplicationVersion - from ._models_py3 import GalleryApplicationVersionList - from ._models_py3 import GalleryApplicationVersionPublishingProfile - from ._models_py3 import GalleryApplicationVersionUpdate - from ._models_py3 import GalleryArtifactPublishingProfileBase - from ._models_py3 import GalleryArtifactSource - from ._models_py3 import GalleryArtifactVersionSource - from ._models_py3 import GalleryDataDiskImage - from ._models_py3 import GalleryDiskImage - from ._models_py3 import GalleryIdentifier - from ._models_py3 import GalleryImage - from ._models_py3 import GalleryImageFeature - from ._models_py3 import GalleryImageIdentifier - from ._models_py3 import GalleryImageList - from ._models_py3 import GalleryImageUpdate - from ._models_py3 import GalleryImageVersion - from ._models_py3 import GalleryImageVersionList - from ._models_py3 import GalleryImageVersionPublishingProfile - from ._models_py3 import GalleryImageVersionStorageProfile - from ._models_py3 import GalleryImageVersionUpdate - from ._models_py3 import GalleryList - from ._models_py3 import GalleryOSDiskImage - from ._models_py3 import GalleryUpdate - from ._models_py3 import GrantAccessData - from ._models_py3 import ImageDiskReference - from ._models_py3 import ImagePurchasePlan - from ._models_py3 import InnerError - from ._models_py3 import KeyForDiskEncryptionSet - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - from ._models_py3 import ManagedArtifact - from ._models_py3 import OSDiskImageEncryption - from ._models_py3 import PirResource - from ._models_py3 import PirSharedGalleryResource - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyOnlyResource - from ._models_py3 import PurchasePlan - from ._models_py3 import RecommendedMachineConfiguration - from ._models_py3 import RegionalReplicationStatus - from ._models_py3 import ReplicationStatus - from ._models_py3 import Resource - from ._models_py3 import ResourceRange - from ._models_py3 import ResourceUriList - from ._models_py3 import ShareInfoElement - from ._models_py3 import SharedGallery - from ._models_py3 import SharedGalleryImage - from ._models_py3 import SharedGalleryImageList - from ._models_py3 import SharedGalleryImageVersion - from ._models_py3 import SharedGalleryImageVersionList - from ._models_py3 import SharedGalleryList - from ._models_py3 import SharingProfile - from ._models_py3 import SharingProfileGroup - from ._models_py3 import SharingUpdate - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import TargetRegion - from ._models_py3 import UpdateResourceDefinition - from ._models_py3 import UserArtifactManage - from ._models_py3 import UserArtifactSource -except (SyntaxError, ImportError): - from ._models import AccessUri # type: ignore - from ._models import ApiError # type: ignore - from ._models import ApiErrorBase # type: ignore - from ._models import CreationData # type: ignore - from ._models import DataDiskImageEncryption # type: ignore - from ._models import Disallowed # type: ignore - from ._models import Disk # type: ignore - from ._models import DiskAccess # type: ignore - from ._models import DiskAccessList # type: ignore - from ._models import DiskAccessUpdate # type: ignore - from ._models import DiskEncryptionSet # type: ignore - from ._models import DiskEncryptionSetList # type: ignore - from ._models import DiskEncryptionSetUpdate # type: ignore - from ._models import DiskImageEncryption # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskRestorePoint # type: ignore - from ._models import DiskRestorePointList # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionImages # type: ignore - from ._models import EncryptionSetIdentity # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import Gallery # type: ignore - from ._models import GalleryApplication # type: ignore - from ._models import GalleryApplicationList # type: ignore - from ._models import GalleryApplicationUpdate # type: ignore - from ._models import GalleryApplicationVersion # type: ignore - from ._models import GalleryApplicationVersionList # type: ignore - from ._models import GalleryApplicationVersionPublishingProfile # type: ignore - from ._models import GalleryApplicationVersionUpdate # type: ignore - from ._models import GalleryArtifactPublishingProfileBase # type: ignore - from ._models import GalleryArtifactSource # type: ignore - from ._models import GalleryArtifactVersionSource # type: ignore - from ._models import GalleryDataDiskImage # type: ignore - from ._models import GalleryDiskImage # type: ignore - from ._models import GalleryIdentifier # type: ignore - from ._models import GalleryImage # type: ignore - from ._models import GalleryImageFeature # type: ignore - from ._models import GalleryImageIdentifier # type: ignore - from ._models import GalleryImageList # type: ignore - from ._models import GalleryImageUpdate # type: ignore - from ._models import GalleryImageVersion # type: ignore - from ._models import GalleryImageVersionList # type: ignore - from ._models import GalleryImageVersionPublishingProfile # type: ignore - from ._models import GalleryImageVersionStorageProfile # type: ignore - from ._models import GalleryImageVersionUpdate # type: ignore - from ._models import GalleryList # type: ignore - from ._models import GalleryOSDiskImage # type: ignore - from ._models import GalleryUpdate # type: ignore - from ._models import GrantAccessData # type: ignore - from ._models import ImageDiskReference # type: ignore - from ._models import ImagePurchasePlan # type: ignore - from ._models import InnerError # type: ignore - from ._models import KeyForDiskEncryptionSet # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # type: ignore - from ._models import ManagedArtifact # type: ignore - from ._models import OSDiskImageEncryption # type: ignore - from ._models import PirResource # type: ignore - from ._models import PirSharedGalleryResource # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyOnlyResource # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import RecommendedMachineConfiguration # type: ignore - from ._models import RegionalReplicationStatus # type: ignore - from ._models import ReplicationStatus # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRange # type: ignore - from ._models import ResourceUriList # type: ignore - from ._models import ShareInfoElement # type: ignore - from ._models import SharedGallery # type: ignore - from ._models import SharedGalleryImage # type: ignore - from ._models import SharedGalleryImageList # type: ignore - from ._models import SharedGalleryImageVersion # type: ignore - from ._models import SharedGalleryImageVersionList # type: ignore - from ._models import SharedGalleryList # type: ignore - from ._models import SharingProfile # type: ignore - from ._models import SharingProfileGroup # type: ignore - from ._models import SharingUpdate # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import TargetRegion # type: ignore - from ._models import UpdateResourceDefinition # type: ignore - from ._models import UserArtifactManage # type: ignore - from ._models import UserArtifactSource # type: ignore +from ._models_py3 import AccessUri +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import CreationData +from ._models_py3 import DataDiskImageEncryption +from ._models_py3 import Disallowed +from ._models_py3 import Disk +from ._models_py3 import DiskAccess +from ._models_py3 import DiskAccessList +from ._models_py3 import DiskAccessUpdate +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskImageEncryption +from ._models_py3 import DiskList +from ._models_py3 import DiskRestorePoint +from ._models_py3 import DiskRestorePointList +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionImages +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import ExtendedLocation +from ._models_py3 import Gallery +from ._models_py3 import GalleryApplication +from ._models_py3 import GalleryApplicationList +from ._models_py3 import GalleryApplicationUpdate +from ._models_py3 import GalleryApplicationVersion +from ._models_py3 import GalleryApplicationVersionList +from ._models_py3 import GalleryApplicationVersionPublishingProfile +from ._models_py3 import GalleryApplicationVersionUpdate +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryArtifactVersionSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryIdentifier +from ._models_py3 import GalleryImage +from ._models_py3 import GalleryImageFeature +from ._models_py3 import GalleryImageIdentifier +from ._models_py3 import GalleryImageList +from ._models_py3 import GalleryImageUpdate +from ._models_py3 import GalleryImageVersion +from ._models_py3 import GalleryImageVersionList +from ._models_py3 import GalleryImageVersionPublishingProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryImageVersionUpdate +from ._models_py3 import GalleryList +from ._models_py3 import GalleryOSDiskImage +from ._models_py3 import GalleryUpdate +from ._models_py3 import GrantAccessData +from ._models_py3 import ImageDiskReference +from ._models_py3 import ImagePurchasePlan +from ._models_py3 import InnerError +from ._models_py3 import KeyForDiskEncryptionSet +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import ManagedArtifact +from ._models_py3 import OSDiskImageEncryption +from ._models_py3 import PirResource +from ._models_py3 import PirSharedGalleryResource +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyOnlyResource +from ._models_py3 import PurchasePlan +from ._models_py3 import RecommendedMachineConfiguration +from ._models_py3 import RegionalReplicationStatus +from ._models_py3 import ReplicationStatus +from ._models_py3 import Resource +from ._models_py3 import ResourceRange +from ._models_py3 import ResourceUriList +from ._models_py3 import ShareInfoElement +from ._models_py3 import SharedGallery +from ._models_py3 import SharedGalleryImage +from ._models_py3 import SharedGalleryImageList +from ._models_py3 import SharedGalleryImageVersion +from ._models_py3 import SharedGalleryImageVersionList +from ._models_py3 import SharedGalleryList +from ._models_py3 import SharingProfile +from ._models_py3 import SharingProfileGroup +from ._models_py3 import SharingUpdate +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import TargetRegion +from ._models_py3 import UpdateResourceDefinition +from ._models_py3 import UserArtifactManage +from ._models_py3 import UserArtifactSource + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py index c6c325a6fd7a..e741f7310aca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the aggregated replication status based on all the regional replication status flags. """ @@ -41,7 +26,7 @@ class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, E COMPLETED = "Completed" FAILED = "Failed" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -64,7 +49,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the disk. UPLOAD = "Upload" -class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources @@ -74,7 +59,7 @@ class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -85,7 +70,7 @@ class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: of the keys is Customer managed and the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible state of the disk. """ @@ -102,7 +87,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -117,7 +102,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: databases (for example, SQL, Oracle), and other transaction-heavy workloads. ULTRA_SSD_LRS = "UltraSSD_LRS" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -131,13 +116,13 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -148,7 +133,7 @@ class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseI DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImagePropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -159,7 +144,7 @@ class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImageVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -170,7 +155,7 @@ class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensi DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -181,7 +166,7 @@ class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta DELETING = "Deleting" MIGRATING = "Migrating" -class GallerySharingPermissionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GallerySharingPermissionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property allows you to specify the permission of sharing gallery. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** :code:`
    `:code:`
    ` **Groups** """ @@ -189,7 +174,7 @@ class GallerySharingPermissionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str PRIVATE = "Private" GROUPS = "Groups" -class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' """ @@ -197,14 +182,14 @@ class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAccessPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for accessing the disk via network. """ @@ -215,7 +200,7 @@ class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The disk cannot be exported. DENY_ALL = "DenyAll" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. """ @@ -223,14 +208,14 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En GENERALIZED = "Generalized" SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -239,7 +224,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -247,7 +232,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the regional replication state. """ @@ -256,19 +241,19 @@ class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAILED = "Failed" -class ReplicationStatusTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationStatusTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REPLICATION_STATUS = "ReplicationStatus" -class SelectPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SelectPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PERMISSIONS = "Permissions" -class SharedToValues(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharedToValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TENANT = "tenant" -class SharingProfileGroupTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharingProfileGroupTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property allows you to specify the type of sharing group. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** :code:`
    `:code:`
    ` **AADTenants** @@ -277,7 +262,7 @@ class SharingProfileGroupTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu SUBSCRIPTIONS = "Subscriptions" AAD_TENANTS = "AADTenants" -class SharingUpdateOperationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharingUpdateOperationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property allows you to specify the operation type of gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset** @@ -287,7 +272,7 @@ class SharingUpdateOperationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, REMOVE = "Remove" RESET = "Reset" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -298,7 +283,7 @@ class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Standard zone redundant storage. STANDARD_ZRS = "Standard_ZRS" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type to be used to store the image. This property is not updatable. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py deleted file mode 100644 index 8adbc15e14b4..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py +++ /dev/null @@ -1,3905 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -class ApiError(msrest.serialization.Model): - """Api error. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_09_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_09_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_09_30.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the - ImageDiskReference will be the ARM id of the shared galley image version from which to create a - disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are - 512 ad 4096. 4096 is the default. - :type logical_sector_size: int - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'gallery_image_reference': {'key': 'galleryImageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - 'logical_sector_size': {'key': 'logicalSectorSize', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.gallery_image_reference = kwargs.get('gallery_image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', None) - self.logical_sector_size = kwargs.get('logical_sector_size', None) - - -class DiskImageEncryption(msrest.serialization.Model): - """This is the disk image encryption base class. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskImageEncryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class DataDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for a data disk image. - - All required parameters must be populated in order to send to Azure. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - :param lun: Required. This property specifies the logical unit number of the data disk. This - value is used to identify data disks within the Virtual Machine and therefore must be unique - for each data disk attached to the Virtual Machine. - :type lun: int - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDiskImageEncryption, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -class Disallowed(msrest.serialization.Model): - """Describes the disallowed disk types. - - :param disk_types: A list of disk types. - :type disk_types: list[str] - """ - - _attribute_map = { - 'disk_types': {'key': 'diskTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Disallowed, self).__init__(**kwargs) - self.disk_types = kwargs.get('disk_types', 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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -class Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the - disk attached. maxShares should be set to a value greater than one for disks to allow attaching - them to multiple VMs. - :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :param extended_location: The extended location where the disk will be created. Extended - location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was - created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: - WindowsServer}. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2020_09_30.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should - be set to a value greater than one for disks to allow attaching them to multiple VMs. - :vartype share_info: list[~azure.mgmt.compute.v2020_09_30.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'managed_by_extended': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'share_info': {'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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'managed_by_extended': {'key': 'managedByExtended', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'share_info': {'key': 'properties.shareInfo', 'type': '[ShareInfoElement]'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.managed_by_extended = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.extended_location = kwargs.get('extended_location', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.disk_state = None - self.encryption = kwargs.get('encryption', None) - self.max_shares = kwargs.get('max_shares', None) - self.share_info = None - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - self.bursting_enabled = kwargs.get('bursting_enabled', None) - - -class DiskAccess(Resource): - """disk access resource. - - 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 private_endpoint_connections: A readonly collection of private endpoint connections - created on the disk. Currently only one endpoint connection is supported. - :vartype private_endpoint_connections: - list[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] - :ivar provisioning_state: The disk access resource provisioning state. - :vartype provisioning_state: str - :ivar time_created: The time when the disk access was created. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'time_created': {'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}'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccess, self).__init__(**kwargs) - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None - - -class DiskAccessList(msrest.serialization.Model): - """The List disk access operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with - this to fetch the next page of disk access resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskAccess]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccessList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskAccessUpdate(msrest.serialization.Model): - """Used for updating a disk access resource. - - :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(DiskAccessUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DiskEncryptionSet(Resource): - """disk encryption set resource. - - 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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'previous_keys': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, - 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyForDiskEncryptionSet]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSet, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - self.previous_keys = None - self.provisioning_state = None - - -class DiskEncryptionSetList(msrest.serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskEncryptionSetUpdate(msrest.serialization.Model): - """disk encryption set update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and - Snapshots. - :type active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - - -class DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ProxyOnlyResource(msrest.serialization.Model): - """The ProxyOnly Resource model definition. - - 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyOnlyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class DiskRestorePoint(ProxyOnlyResource): - """Properties of disk restore point. - - 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 time_created: The timestamp of restorePoint creation. - :vartype time_created: ~datetime.datetime - :ivar source_resource_id: arm id of source disk. - :vartype source_resource_id: str - :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". - :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was - created. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan - :ivar family_id: id of the backing snapshot's MIS family. - :vartype family_id: str - :ivar source_unique_id: unique incarnation id of the source disk. - :vartype source_unique_id: str - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'time_created': {'readonly': True}, - 'source_resource_id': {'readonly': True}, - 'os_type': {'readonly': True}, - 'family_id': {'readonly': True}, - 'source_unique_id': {'readonly': True}, - 'encryption': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - 'family_id': {'key': 'properties.familyId', 'type': 'str'}, - 'source_unique_id': {'key': 'properties.sourceUniqueId', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskRestorePoint, self).__init__(**kwargs) - self.time_created = None - self.source_resource_id = None - self.os_type = None - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.family_id = None - self.source_unique_id = None - self.encryption = None - - -class DiskRestorePointList(msrest.serialization.Model): - """The List Disk Restore Points operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk restore points. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePoint] - :param next_link: The uri to fetch the next page of disk restore points. Call ListNext() with - this to fetch the next page of disk restore points. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskRestorePoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskRestorePointList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2020_09_30.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :param purchase_plan: Purchase plan information to be added on the OS disk. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.max_shares = kwargs.get('max_shares', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - self.bursting_enabled = kwargs.get('bursting_enabled', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - - -class Encryption(msrest.serialization.Model): - """Encryption at rest settings for disk or snapshot. - - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", - "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_09_30.models.EncryptionType - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.type = kwargs.get('type', None) - - -class EncryptionImages(msrest.serialization.Model): - """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. - - :param os_disk_image: Contains encryption settings for an OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.OSDiskImageEncryption - :param data_disk_images: A list of encryption specifications for data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2020_09_30.models.DataDiskImageEncryption] - """ - - _attribute_map = { - 'os_disk_image': {'key': 'osDiskImage', 'type': 'OSDiskImageEncryption'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[DataDiskImageEncryption]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionImages, self).__init__(**kwargs) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', None) - - -class EncryptionSetIdentity(msrest.serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported for new creations. Disk Encryption Sets can be updated with Identity type None during - migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted - resources to lose access to the keys. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSetIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', 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.v2020_09_30.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 Gallery(Resource): - """Specifies information about the Shared Image Gallery that you want to create or update. - - 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 description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'sharing_profile': {'key': 'properties.sharingProfile', 'type': 'SharingProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(Gallery, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - self.sharing_profile = kwargs.get('sharing_profile', None) - - -class GalleryApplication(Resource): - """Specifies information about the gallery Application Definition that you want to create or update. - - 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 description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplication, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationList(msrest.serialization.Model): - """The List Gallery Applications operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application - Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class UpdateResourceDefinition(msrest.serialization.Model): - """The Update Resource model definition. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateResourceDefinition, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - - -class GalleryApplicationUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Definition that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationVersion(Resource): - """Specifies information about the gallery Application Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2020_09_30.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryApplicationVersionList(msrest.serialization.Model): - """The List Gallery Application version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call - ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplicationVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): - """Describes the basic gallery artifact publishing profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) - self.target_regions = kwargs.get('target_regions', None) - self.replica_count = kwargs.get('replica_count', None) - self.exclude_from_latest = kwargs.get('exclude_from_latest', None) - self.published_date = None - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - - -class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image version. - - 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 target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool - """ - - _validation = { - 'published_date': {'readonly': True}, - 'source': {'required': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, - 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) - self.source = kwargs['source'] - self.manage_actions = kwargs.get('manage_actions', None) - self.enable_health_check = kwargs.get('enable_health_check', None) - - -class GalleryApplicationVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Version that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2020_09_30.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2020_09_30.models.ManagedArtifact - """ - - _validation = { - 'managed_image': {'required': True}, - } - - _attribute_map = { - 'managed_image': {'key': 'managedImage', 'type': 'ManagedArtifact'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactSource, self).__init__(**kwargs) - self.managed_image = kwargs['managed_image'] - - -class GalleryArtifactVersionSource(msrest.serialization.Model): - """The gallery artifact version source. - - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, - user image or storage account resource. - :type id: str - :param uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob - source. - :type uri: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactVersionSource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.uri = kwargs.get('uri', None) - - -class GalleryDiskImage(msrest.serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDiskImage, self).__init__(**kwargs) - self.size_in_gb = None - self.host_caching = kwargs.get('host_caching', None) - self.source = kwargs.get('source', None) - - -class GalleryDataDiskImage(GalleryDiskImage): - """This is the data disk 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 size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This - value is used to identify data disks within the Virtual Machine and therefore must be unique - for each data disk attached to the Virtual Machine. - :type lun: int - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'lun': {'required': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDataDiskImage, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -class GalleryIdentifier(msrest.serialization.Model): - """Describes the gallery unique name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated - automatically by Azure. - :vartype unique_name: str - """ - - _validation = { - 'unique_name': {'readonly': True}, - } - - _attribute_map = { - 'unique_name': {'key': 'uniqueName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryIdentifier, self).__init__(**kwargs) - self.unique_name = None - - -class GalleryImage(Resource): - """Specifies information about the gallery image definition that you want to create or update. - - 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 description: The description of this gallery image definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2020_09_30.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryImagePropertiesProvisioningState - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImage, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.features = kwargs.get('features', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageFeature(msrest.serialization.Model): - """A feature for gallery image. - - :param name: The name of the gallery image feature. - :type name: str - :param value: The value of the gallery image feature. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageFeature, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class GalleryImageIdentifier(msrest.serialization.Model): - """This is the gallery image definition identifier. - - All required parameters must be populated in order to send to Azure. - - :param publisher: Required. The name of the gallery image definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery image definition offer. - :type offer: str - :param sku: Required. The name of the gallery image definition SKU. - :type sku: str - """ - - _validation = { - 'publisher': {'required': True}, - 'offer': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageIdentifier, self).__init__(**kwargs) - self.publisher = kwargs['publisher'] - self.offer = kwargs['offer'] - self.sku = kwargs['sku'] - - -class GalleryImageList(msrest.serialization.Model): - """The List Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageUpdate(UpdateResourceDefinition): - """Specifies information about the gallery image definition that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery image definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2020_09_30.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryImagePropertiesProvisioningState - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.features = kwargs.get('features', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - - -class GalleryImageVersion(Resource): - """Specifies information about the gallery image version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2020_09_30.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryImageVersionList(msrest.serialization.Model): - """The List Gallery Image version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery image versions. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery image versions. Call ListNext() - with this to fetch the next page of gallery image versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionPublishingProfile, self).__init__(**kwargs) - - -class GalleryImageVersionStorageProfile(msrest.serialization.Model): - """This is the storage profile of a Gallery Image Version. - - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2020_09_30.models.GalleryDataDiskImage] - """ - - _attribute_map = { - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'os_disk_image': {'key': 'osDiskImage', 'type': 'GalleryOSDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[GalleryDataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', None) - - -class GalleryImageVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery image version that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2020_09_30.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryList(msrest.serialization.Model): - """The List Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Gallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryOSDiskImage, self).__init__(**kwargs) - - -class GalleryUpdate(UpdateResourceDefinition): - """Specifies information about the Shared Image Gallery that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'sharing_profile': {'key': 'properties.sharingProfile', 'type': 'SharingProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - self.sharing_profile = kwargs.get('sharing_profile', None) - - -class GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_09_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -class ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -class ImagePurchasePlan(msrest.serialization.Model): - """Describes the gallery image definition purchase plan. This is used by marketplace images. - - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImagePurchasePlan, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.publisher = kwargs.get('publisher', None) - self.product = kwargs.get('product', 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 KeyForDiskEncryptionSet(msrest.serialization.Model): - """Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Resource id of the KeyVault containing the key or secret. This property is - optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption - Set subscription. - :type source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault - :param key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. - :type key_url: str - """ - - _validation = { - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyForDiskEncryptionSet, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.key_url = kwargs['key_url'] - - -class KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -class ManagedArtifact(msrest.serialization.Model): - """The managed artifact. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The managed artifact id. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedArtifact, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class OSDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for an OS disk image. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OSDiskImageEncryption, self).__init__(**kwargs) - - -class PirResource(msrest.serialization.Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PirResource, self).__init__(**kwargs) - self.name = None - self.location = None - - -class PirSharedGalleryResource(PirResource): - """Base information about the shared gallery resource in pir. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PirSharedGalleryResource, self).__init__(**kwargs) - self.unique_id = kwargs.get('unique_id', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(msrest.serialization.Model): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private endpoint connection Id. - :vartype id: str - :ivar name: private endpoint connection name. - :vartype name: str - :ivar type: private endpoint connection type. - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: - ~azure.mgmt.compute.v2020_09_30.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnectionProvisioningState - """ - - _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'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(msrest.serialization.Model): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private link resource Id. - :vartype id: str - :ivar name: private link resource name. - :vartype name: str - :ivar type: private link resource type. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -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 name: Required. The plan ID. - :type name: str - :param publisher: Required. The publisher ID. - :type publisher: 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 - :param promotion_code: The Offer Promotion Code. - :type promotion_code: str - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, - } - - _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(PurchasePlan, self).__init__(**kwargs) - self.name = kwargs['name'] - self.publisher = kwargs['publisher'] - self.product = kwargs['product'] - self.promotion_code = kwargs.get('promotion_code', None) - - -class RecommendedMachineConfiguration(msrest.serialization.Model): - """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange - """ - - _attribute_map = { - 'v_cp_us': {'key': 'vCPUs', 'type': 'ResourceRange'}, - 'memory': {'key': 'memory', 'type': 'ResourceRange'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedMachineConfiguration, self).__init__(**kwargs) - self.v_cp_us = kwargs.get('v_cp_us', None) - self.memory = kwargs.get('memory', None) - - -class RegionalReplicationStatus(msrest.serialization.Model): - """This is the regional replication status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: The region to which the gallery image version is being replicated to. - :vartype region: str - :ivar state: This is the regional replication state. Possible values include: "Unknown", - "Replicating", "Completed", "Failed". - :vartype state: str or ~azure.mgmt.compute.v2020_09_30.models.ReplicationState - :ivar details: The details of the replication status. - :vartype details: str - :ivar progress: It indicates progress of the replication job. - :vartype progress: int - """ - - _validation = { - 'region': {'readonly': True}, - 'state': {'readonly': True}, - 'details': {'readonly': True}, - 'progress': {'readonly': True}, - } - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalReplicationStatus, self).__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None - - -class ReplicationStatus(msrest.serialization.Model): - """This is the replication status of the gallery image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: This is the aggregated replication status based on all the regional - replication status flags. Possible values include: "Unknown", "InProgress", "Completed", - "Failed". - :vartype aggregated_state: str or - ~azure.mgmt.compute.v2020_09_30.models.AggregatedReplicationState - :ivar summary: This is a summary of replication status for each region. - :vartype summary: list[~azure.mgmt.compute.v2020_09_30.models.RegionalReplicationStatus] - """ - - _validation = { - 'aggregated_state': {'readonly': True}, - 'summary': {'readonly': True}, - } - - _attribute_map = { - 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': '[RegionalReplicationStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationStatus, self).__init__(**kwargs) - self.aggregated_state = None - self.summary = None - - -class ResourceRange(msrest.serialization.Model): - """Describes the resource range. - - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int - """ - - _attribute_map = { - 'min': {'key': 'min', 'type': 'int'}, - 'max': {'key': 'max', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRange, self).__init__(**kwargs) - self.min = kwargs.get('min', None) - self.max = kwargs.get('max', None) - - -class ResourceUriList(msrest.serialization.Model): - """The List resources which are encrypted with the disk encryption set. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the - disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with - this to fetch the next page of encrypted resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUriList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SharedGallery(PirSharedGalleryResource): - """Specifies information about the Shared Gallery that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGallery, self).__init__(**kwargs) - - -class SharedGalleryImage(PirSharedGalleryResource): - """Specifies information about the gallery image definition that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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.v2020_09_30.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImage, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.features = kwargs.get('features', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - - -class SharedGalleryImageList(msrest.serialization.Model): - """The List Shared Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of shared gallery images. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImage] - :param next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with - this to fetch the next page of shared gallery images. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedGalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SharedGalleryImageVersion(PirSharedGalleryResource): - """Specifies information about the gallery image version that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - 'published_date': {'key': 'properties.publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImageVersion, self).__init__(**kwargs) - self.published_date = kwargs.get('published_date', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - - -class SharedGalleryImageVersionList(msrest.serialization.Model): - """The List Shared Gallery Image versions operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of shared gallery images versions. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersion] - :param next_link: The uri to fetch the next page of shared gallery image versions. Call - ListNext() with this to fetch the next page of shared gallery image versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedGalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SharedGalleryList(msrest.serialization.Model): - """The List Shared Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of shared galleries. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGallery] - :param next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this - to fetch the next page of shared galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedGallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ShareInfoElement(msrest.serialization.Model): - """ShareInfoElement. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. - :vartype vm_uri: str - """ - - _validation = { - 'vm_uri': {'readonly': True}, - } - - _attribute_map = { - 'vm_uri': {'key': 'vmUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareInfoElement, self).__init__(**kwargs) - self.vm_uri = None - - -class SharingProfile(msrest.serialization.Model): - """Profile for gallery sharing to subscription or tenant. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param permissions: This property allows you to specify the permission of sharing gallery. - :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** - :code:`
    `:code:`
    ` **Groups**. Possible values include: "Private", "Groups". - :type permissions: str or ~azure.mgmt.compute.v2020_09_30.models.GallerySharingPermissionTypes - :ivar groups: A list of sharing profile groups. - :vartype groups: list[~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroup] - """ - - _validation = { - 'groups': {'readonly': True}, - } - - _attribute_map = { - 'permissions': {'key': 'permissions', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[SharingProfileGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingProfile, self).__init__(**kwargs) - self.permissions = kwargs.get('permissions', None) - self.groups = None - - -class SharingProfileGroup(msrest.serialization.Model): - """Group of the gallery sharing profile. - - :param type: This property allows you to specify the type of sharing group. - :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** - :code:`
    `:code:`
    ` **AADTenants**. Possible values include: "Subscriptions", - "AADTenants". - :type type: str or ~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroupTypes - :param ids: A list of subscription/tenant ids the gallery is aimed to be shared to. - :type ids: list[str] - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'ids': {'key': 'ids', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingProfileGroup, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.ids = kwargs.get('ids', None) - - -class SharingUpdate(msrest.serialization.Model): - """Specifies information about the gallery sharing profile update. - - All required parameters must be populated in order to send to Azure. - - :param operation_type: Required. This property allows you to specify the operation type of - gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` - **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset**. Possible values - include: "Add", "Remove", "Reset". - :type operation_type: str or ~azure.mgmt.compute.v2020_09_30.models.SharingUpdateOperationTypes - :param groups: A list of sharing profile groups. - :type groups: list[~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroup] - """ - - _validation = { - 'operation_type': {'required': True}, - } - - _attribute_map = { - 'operation_type': {'key': 'operationType', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[SharingProfileGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingUpdate, self).__init__(**kwargs) - self.operation_type = kwargs['operation_type'] - self.groups = kwargs.get('groups', None) - - -class Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku - :param extended_location: The extended location where the snapshot will be created. Extended - location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation - :ivar time_created: The time when the snapshot was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the image from which the source disk for - the snapshot was originally created. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2020_09_30.models.DiskState - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.extended_location = kwargs.get('extended_location', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_09_30.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class TargetRegion(msrest.serialization.Model): - """Describes the target region information. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType - :param encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.EncryptionImages - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'regional_replica_count': {'key': 'regionalReplicaCount', 'type': 'int'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'EncryptionImages'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetRegion, self).__init__(**kwargs) - self.name = kwargs['name'] - self.regional_replica_count = kwargs.get('regional_replica_count', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - self.encryption = kwargs.get('encryption', None) - - -class UserArtifactManage(msrest.serialization.Model): - """UserArtifactManage. - - All required parameters must be populated in order to send to Azure. - - :param install: Required. Required. The path and arguments to install the gallery application. - This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. - This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not - present, then update operation will invoke remove command on the previous version and install - command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str - """ - - _validation = { - 'install': {'required': True}, - 'remove': {'required': True}, - } - - _attribute_map = { - 'install': {'key': 'install', 'type': 'str'}, - 'remove': {'key': 'remove', 'type': 'str'}, - 'update': {'key': 'update', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactManage, self).__init__(**kwargs) - self.install = kwargs['install'] - self.remove = kwargs['remove'] - self.update = kwargs.get('update', None) - - -class UserArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must - be a readable storage page blob. - :type default_configuration_link: str - """ - - _validation = { - 'media_link': {'required': True}, - } - - _attribute_map = { - 'media_link': {'key': 'mediaLink', 'type': 'str'}, - 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactSource, self).__init__(**kwargs) - self.media_link = kwargs['media_link'] - self.default_configuration_link = kwargs.get('default_configuration_link', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py index 29aee2d21c34..11de601d220a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,16 +44,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_09_30.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_09_30.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2020_09_30.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2020_09_30.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -72,6 +74,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2020_09_30.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2020_09_30.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -83,12 +97,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -105,6 +119,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -118,34 +140,34 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_09_30.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager + :vartype create_option: str or ~azure.mgmt.compute.v2020_09_30.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype gallery_image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are + :vartype upload_size_bytes: long + :ivar logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default. - :type logical_sector_size: int + :vartype logical_sector_size: int """ _validation = { @@ -178,6 +200,33 @@ def __init__( logical_sector_size: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_09_30.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference + :keyword gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :paramtype gallery_image_reference: ~azure.mgmt.compute.v2020_09_30.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + :keyword logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values + are 512 ad 4096. 4096 is the default. + :paramtype logical_sector_size: int + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -193,9 +242,9 @@ def __init__( class DiskImageEncryption(msrest.serialization.Model): """This is the disk image encryption base class. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str + :vartype disk_encryption_set_id: str """ _attribute_map = { @@ -208,6 +257,11 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ super(DiskImageEncryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id @@ -217,13 +271,13 @@ class DataDiskImageEncryption(DiskImageEncryption): All required parameters must be populated in order to send to Azure. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str - :param lun: Required. This property specifies the logical unit number of the data disk. This + :vartype disk_encryption_set_id: str + :ivar lun: Required. This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - :type lun: int + :vartype lun: int """ _validation = { @@ -242,6 +296,15 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ super(DataDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) self.lun = lun @@ -249,8 +312,8 @@ def __init__( class Disallowed(msrest.serialization.Model): """Describes the disallowed disk types. - :param disk_types: A list of disk types. - :type disk_types: list[str] + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] """ _attribute_map = { @@ -263,6 +326,10 @@ def __init__( disk_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ super(Disallowed, self).__init__(**kwargs) self.disk_types = disk_types @@ -280,10 +347,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -308,6 +375,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -329,91 +402,92 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :param extended_location: The extended location where the disk will be created. Extended + :vartype sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] + :ivar extended_location: The extended location where the disk will be created. Extended location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation + :vartype extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long + :vartype disk_m_bps_read_only: long :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2020_09_30.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype share_info: list[~azure.mgmt.compute.v2020_09_30.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool + :vartype bursting_enabled: bool """ _validation = { @@ -492,6 +566,75 @@ def __init__( bursting_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword extended_location: The extended location where the disk will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + WindowsServer}. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.managed_by_extended = None @@ -535,10 +678,10 @@ class DiskAccess(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar private_endpoint_connections: A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. :vartype private_endpoint_connections: @@ -577,6 +720,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccess, self).__init__(location=location, tags=tags, **kwargs) self.private_endpoint_connections = None self.provisioning_state = None @@ -588,11 +737,11 @@ class DiskAccessList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with + :ivar value: Required. A list of disk access resources. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] + :ivar next_link: The uri to fetch the next page of disk access resources. Call ListNext() with this to fetch the next page of disk access resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -611,6 +760,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk access resources. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] + :keyword next_link: The uri to fetch the next page of disk access resources. Call ListNext() + with this to fetch the next page of disk access resources. + :paramtype next_link: str + """ super(DiskAccessList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -619,8 +775,8 @@ def __init__( class DiskAccessUpdate(msrest.serialization.Model): """Used for updating a disk access resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -633,6 +789,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccessUpdate, self).__init__(**kwargs) self.tags = tags @@ -650,18 +810,18 @@ class DiskEncryptionSet(Resource): :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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet :ivar previous_keys: A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. @@ -702,6 +862,20 @@ def __init__( active_key: Optional["KeyForDiskEncryptionSet"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet + """ super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.encryption_type = encryption_type @@ -715,11 +889,11 @@ class DiskEncryptionSetList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -738,6 +912,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ super(DiskEncryptionSetList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -746,14 +927,14 @@ def __init__( class DiskEncryptionSetUpdate(msrest.serialization.Model): """disk encryption set update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType + :ivar active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. - :type active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet + :vartype active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet """ _attribute_map = { @@ -770,6 +951,16 @@ def __init__( active_key: Optional["KeyForDiskEncryptionSet"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetType + :keyword active_key: Key Vault Key Url to be used for server side encryption of Managed Disks + and Snapshots. + :paramtype active_key: ~azure.mgmt.compute.v2020_09_30.models.KeyForDiskEncryptionSet + """ super(DiskEncryptionSetUpdate, self).__init__(**kwargs) self.tags = tags self.encryption_type = encryption_type @@ -781,11 +972,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -804,6 +995,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -838,6 +1036,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -861,12 +1061,12 @@ class DiskRestorePoint(ProxyOnlyResource): :vartype source_resource_id: str :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan :ivar family_id: id of the backing snapshot's MIS family. :vartype family_id: str :ivar source_unique_id: unique incarnation id of the source disk. @@ -909,6 +1109,14 @@ def __init__( purchase_plan: Optional["PurchasePlan"] = None, **kwargs ): + """ + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + """ super(DiskRestorePoint, self).__init__(**kwargs) self.time_created = None self.source_resource_id = None @@ -925,11 +1133,11 @@ class DiskRestorePointList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk restore points. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePoint] - :param next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + :ivar value: Required. A list of disk restore points. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePoint] + :ivar next_link: The uri to fetch the next page of disk restore points. Call ListNext() with this to fetch the next page of disk restore points. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -948,6 +1156,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk restore points. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePoint] + :keyword next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + this to fetch the next page of disk restore points. + :paramtype next_link: str + """ super(DiskRestorePointList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -958,9 +1173,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS". - :type name: str or ~azure.mgmt.compute.v2020_09_30.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_09_30.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -980,6 +1195,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_09_30.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -988,56 +1208,57 @@ def __init__( class DiskUpdate(msrest.serialization.Model): """Disk update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype disk_m_bps_read_only: long + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :param purchase_plan: Purchase plan information to be added on the OS disk. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + :vartype bursting_enabled: bool + :ivar purchase_plan: Purchase plan information to be added on the OS disk. + :vartype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan """ _attribute_map = { @@ -1080,6 +1301,60 @@ def __init__( purchase_plan: Optional["PurchasePlan"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + :paramtype sku: ~azure.mgmt.compute.v2020_09_30.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + :keyword purchase_plan: Purchase plan information to be added on the OS disk. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1102,13 +1377,13 @@ def __init__( class Encryption(msrest.serialization.Model): """Encryption at rest settings for disk or snapshot. - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_09_30.models.EncryptionType + :vartype type: str or ~azure.mgmt.compute.v2020_09_30.models.EncryptionType """ _attribute_map = { @@ -1123,6 +1398,15 @@ def __init__( type: Optional[Union[str, "EncryptionType"]] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype type: str or ~azure.mgmt.compute.v2020_09_30.models.EncryptionType + """ super(Encryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id self.type = type @@ -1131,10 +1415,10 @@ def __init__( class EncryptionImages(msrest.serialization.Model): """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. - :param os_disk_image: Contains encryption settings for an OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.OSDiskImageEncryption - :param data_disk_images: A list of encryption specifications for data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2020_09_30.models.DataDiskImageEncryption] + :ivar os_disk_image: Contains encryption settings for an OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.OSDiskImageEncryption + :ivar data_disk_images: A list of encryption specifications for data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2020_09_30.models.DataDiskImageEncryption] """ _attribute_map = { @@ -1149,6 +1433,13 @@ def __init__( data_disk_images: Optional[List["DataDiskImageEncryption"]] = None, **kwargs ): + """ + :keyword os_disk_image: Contains encryption settings for an OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.OSDiskImageEncryption + :keyword data_disk_images: A list of encryption specifications for data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2020_09_30.models.DataDiskImageEncryption] + """ super(EncryptionImages, self).__init__(**kwargs) self.os_disk_image = os_disk_image self.data_disk_images = data_disk_images @@ -1159,11 +1450,11 @@ class EncryptionSetIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetIdentityType + :vartype type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetIdentityType :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity. @@ -1191,6 +1482,14 @@ def __init__( type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported for new creations. Disk Encryption Sets can be updated with Identity type None + during migration of subscription to a new Azure Active Directory tenant; it will cause the + encrypted resources to lose access to the keys. Possible values include: "SystemAssigned", + "None". + :paramtype type: str or ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetIdentityType + """ super(EncryptionSetIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -1202,18 +1501,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -1234,6 +1533,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -1243,11 +1556,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -1262,6 +1575,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2020_09_30.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -1270,10 +1591,10 @@ def __init__( 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.v2020_09_30.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocationTypes """ _attribute_map = { @@ -1288,6 +1609,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -1306,21 +1633,21 @@ class Gallery(Resource): :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 description: The description of this Shared Image Gallery resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2020_09_30.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile """ _validation = { @@ -1353,6 +1680,19 @@ def __init__( sharing_profile: Optional["SharingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile + """ super(Gallery, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -1373,27 +1713,27 @@ class GalleryApplication(Resource): :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 description: The description of this gallery Application Definition resource. This + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes """ _validation = { @@ -1430,6 +1770,30 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + """ super(GalleryApplication, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -1444,11 +1808,11 @@ class GalleryApplicationList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application + :ivar value: Required. A list of Gallery Applications. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] + :ivar next_link: The uri to fetch the next page of Application Definitions in the Application Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1467,6 +1831,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Gallery Applications. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] + :keyword next_link: The uri to fetch the next page of Application Definitions in the + Application Gallery. Call ListNext() with this to fetch the next page of gallery Application + Definitions. + :paramtype next_link: str + """ super(GalleryApplicationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1483,8 +1855,8 @@ class UpdateResourceDefinition(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -1506,6 +1878,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResourceDefinition, self).__init__(**kwargs) self.id = None self.name = None @@ -1524,25 +1900,25 @@ class GalleryApplicationUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes """ _validation = { @@ -1576,6 +1952,28 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + """ super(GalleryApplicationUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -1598,12 +1996,12 @@ class GalleryApplicationVersion(Resource): :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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -1641,6 +2039,15 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -1652,11 +2059,11 @@ class GalleryApplicationVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call + :ivar value: Required. A list of gallery Application Versions. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] + :ivar next_link: The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1675,6 +2082,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Application Versions. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] + :keyword next_link: The uri to fetch the next page of gallery Application Versions. Call + ListNext() with this to fetch the next page of gallery Application Versions. + :paramtype next_link: str + """ super(GalleryApplicationVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1685,25 +2099,25 @@ class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery image version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType """ _validation = { @@ -1729,6 +2143,26 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + """ super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) self.target_regions = target_regions self.replica_count = replica_count @@ -1745,31 +2179,31 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery image version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool + :vartype storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactManage + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool """ _validation = { @@ -1802,6 +2236,33 @@ def __init__( enable_health_check: Optional[bool] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactSource + :keyword manage_actions: + :paramtype manage_actions: ~azure.mgmt.compute.v2020_09_30.models.UserArtifactManage + :keyword enable_health_check: Optional. Whether or not this application reports health. + :paramtype enable_health_check: bool + """ super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source self.manage_actions = manage_actions @@ -1819,10 +2280,10 @@ class GalleryApplicationVersionUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -1857,6 +2318,13 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -1868,8 +2336,8 @@ class GalleryArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2020_09_30.models.ManagedArtifact + :ivar managed_image: Required. The managed artifact. + :vartype managed_image: ~azure.mgmt.compute.v2020_09_30.models.ManagedArtifact """ _validation = { @@ -1886,6 +2354,10 @@ def __init__( managed_image: "ManagedArtifact", **kwargs ): + """ + :keyword managed_image: Required. The managed artifact. + :paramtype managed_image: ~azure.mgmt.compute.v2020_09_30.models.ManagedArtifact + """ super(GalleryArtifactSource, self).__init__(**kwargs) self.managed_image = managed_image @@ -1893,12 +2365,12 @@ def __init__( class GalleryArtifactVersionSource(msrest.serialization.Model): """The gallery artifact version source. - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, + :ivar id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. - :type id: str - :param uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob + :vartype id: str + :ivar uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob source. - :type uri: str + :vartype uri: str """ _attribute_map = { @@ -1913,6 +2385,14 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword id: The id of the gallery artifact version source. Can specify a disk uri, snapshot + uri, user image or storage account resource. + :paramtype id: str + :keyword uri: The uri of the gallery artifact version source. Currently used to specify + vhd/blob source. + :paramtype uri: str + """ super(GalleryArtifactVersionSource, self).__init__(**kwargs) self.id = id self.uri = uri @@ -1925,11 +2405,11 @@ class GalleryDiskImage(msrest.serialization.Model): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource """ _validation = { @@ -1949,6 +2429,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + """ super(GalleryDiskImage, self).__init__(**kwargs) self.size_in_gb = None self.host_caching = host_caching @@ -1964,15 +2451,15 @@ class GalleryDataDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This + :vartype host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + :ivar lun: Required. This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - :type lun: int + :vartype lun: int """ _validation = { @@ -1995,6 +2482,17 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ super(GalleryDataDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) self.lun = lun @@ -2021,6 +2519,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryIdentifier, self).__init__(**kwargs) self.unique_name = None @@ -2038,46 +2538,46 @@ class GalleryImage(Resource): :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 description: The description of this gallery image definition resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery image definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery image definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2020_09_30.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2134,6 +2634,48 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery image definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery image definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan + """ super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -2154,10 +2696,10 @@ def __init__( class GalleryImageFeature(msrest.serialization.Model): """A feature for gallery image. - :param name: The name of the gallery image feature. - :type name: str - :param value: The value of the gallery image feature. - :type value: str + :ivar name: The name of the gallery image feature. + :vartype name: str + :ivar value: The value of the gallery image feature. + :vartype value: str """ _attribute_map = { @@ -2172,6 +2714,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the gallery image feature. + :paramtype name: str + :keyword value: The value of the gallery image feature. + :paramtype value: str + """ super(GalleryImageFeature, self).__init__(**kwargs) self.name = name self.value = value @@ -2182,12 +2730,12 @@ class GalleryImageIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param publisher: Required. The name of the gallery image definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery image definition offer. - :type offer: str - :param sku: Required. The name of the gallery image definition SKU. - :type sku: str + :ivar publisher: Required. The name of the gallery image definition publisher. + :vartype publisher: str + :ivar offer: Required. The name of the gallery image definition offer. + :vartype offer: str + :ivar sku: Required. The name of the gallery image definition SKU. + :vartype sku: str """ _validation = { @@ -2210,6 +2758,14 @@ def __init__( sku: str, **kwargs ): + """ + :keyword publisher: Required. The name of the gallery image definition publisher. + :paramtype publisher: str + :keyword offer: Required. The name of the gallery image definition offer. + :paramtype offer: str + :keyword sku: Required. The name of the gallery image definition SKU. + :paramtype sku: str + """ super(GalleryImageIdentifier, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -2221,11 +2777,11 @@ class GalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image + :ivar value: Required. A list of Shared Image Gallery images. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] + :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2244,6 +2800,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Shared Image Gallery images. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] + :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. + :paramtype next_link: str + """ super(GalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2260,44 +2823,44 @@ class GalleryImageUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery image definition resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery image definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery image definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2020_09_30.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or @@ -2351,6 +2914,46 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery image definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery image definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan + """ super(GalleryImageUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -2381,19 +2984,20 @@ class GalleryImageVersion(Resource): :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 publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery image version. :vartype replication_status: ~azure.mgmt.compute.v2020_09_30.models.ReplicationStatus """ @@ -2428,6 +3032,18 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2440,11 +3056,11 @@ class GalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery image versions. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery image versions. Call ListNext() - with this to fetch the next page of gallery image versions. - :type next_link: str + :ivar value: Required. A list of gallery image versions. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] + :ivar next_link: The uri to fetch the next page of gallery image versions. Call ListNext() with + this to fetch the next page of gallery image versions. + :vartype next_link: str """ _validation = { @@ -2463,6 +3079,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery image versions. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] + :keyword next_link: The uri to fetch the next page of gallery image versions. Call ListNext() + with this to fetch the next page of gallery image versions. + :paramtype next_link: str + """ super(GalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2473,25 +3096,25 @@ class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase) Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery image version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType """ _validation = { @@ -2517,18 +3140,38 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2020_09_30.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + """ super(GalleryImageVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) class GalleryImageVersionStorageProfile(msrest.serialization.Model): """This is the storage profile of a Gallery Image Version. - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2020_09_30.models.GalleryDataDiskImage] + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2020_09_30.models.GalleryDataDiskImage] """ _attribute_map = { @@ -2545,6 +3188,14 @@ def __init__( data_disk_images: Optional[List["GalleryDataDiskImage"]] = None, **kwargs ): + """ + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: list[~azure.mgmt.compute.v2020_09_30.models.GalleryDataDiskImage] + """ super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) self.source = source self.os_disk_image = os_disk_image @@ -2562,17 +3213,18 @@ class GalleryImageVersionUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery image version. :vartype replication_status: ~azure.mgmt.compute.v2020_09_30.models.ReplicationStatus """ @@ -2604,6 +3256,16 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2616,11 +3278,11 @@ class GalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + :ivar value: Required. A list of galleries. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.Gallery] + :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2639,6 +3301,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of galleries. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.Gallery] + :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :paramtype next_link: str + """ super(GalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2651,11 +3320,11 @@ class GalleryOSDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource """ _validation = { @@ -2675,6 +3344,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2020_09_30.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2020_09_30.models.GalleryArtifactVersionSource + """ super(GalleryOSDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) @@ -2689,19 +3365,19 @@ class GalleryUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this Shared Image Gallery resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2020_09_30.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile """ _validation = { @@ -2731,6 +3407,17 @@ def __init__( sharing_profile: Optional["SharingProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2020_09_30.models.SharingProfile + """ super(GalleryUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -2743,10 +3430,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_09_30.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2020_09_30.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -2766,6 +3453,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2020_09_30.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -2776,12 +3469,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -2800,6 +3493,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -2808,12 +3509,12 @@ def __init__( class ImagePurchasePlan(msrest.serialization.Model): """Describes the gallery image definition purchase plan. This is used by marketplace images. - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str """ _attribute_map = { @@ -2830,6 +3531,14 @@ def __init__( product: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product ID. + :paramtype product: str + """ super(ImagePurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -2839,10 +3548,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -2857,6 +3566,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -2867,12 +3582,12 @@ class KeyForDiskEncryptionSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Resource id of the KeyVault containing the key or secret. This property is + :ivar source_vault: Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. - :type source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault - :param key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. - :type key_url: str + :vartype source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault + :ivar key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. + :vartype key_url: str """ _validation = { @@ -2891,6 +3606,14 @@ def __init__( source_vault: Optional["SourceVault"] = None, **kwargs ): + """ + :keyword source_vault: Resource id of the KeyVault containing the key or secret. This property + is optional and cannot be used if the KeyVault subscription is not the same as the Disk + Encryption Set subscription. + :paramtype source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault + :keyword key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. + :paramtype key_url: str + """ super(KeyForDiskEncryptionSet, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -2901,10 +3624,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -2924,6 +3647,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -2934,10 +3663,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -2957,6 +3686,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_09_30.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -2967,8 +3702,8 @@ class ManagedArtifact(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The managed artifact id. - :type id: str + :ivar id: Required. The managed artifact id. + :vartype id: str """ _validation = { @@ -2985,6 +3720,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ super(ManagedArtifact, self).__init__(**kwargs) self.id = id @@ -2992,9 +3731,9 @@ def __init__( class OSDiskImageEncryption(DiskImageEncryption): """Contains encryption settings for an OS disk image. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str + :vartype disk_encryption_set_id: str """ _attribute_map = { @@ -3007,6 +3746,11 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ super(OSDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) @@ -3035,6 +3779,8 @@ def __init__( self, **kwargs ): + """ + """ super(PirResource, self).__init__(**kwargs) self.name = None self.location = None @@ -3049,8 +3795,8 @@ class PirSharedGalleryResource(PirResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str """ _validation = { @@ -3070,6 +3816,10 @@ def __init__( unique_id: Optional[str] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ super(PirSharedGalleryResource, self).__init__(**kwargs) self.unique_id = unique_id @@ -3095,6 +3845,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3110,11 +3862,11 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: private endpoint connection type. :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between DiskAccess and Virtual Network. + :vartype private_link_service_connection_state: ~azure.mgmt.compute.v2020_09_30.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -3145,6 +3897,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between DiskAccess and Virtual Network. + :paramtype private_link_service_connection_state: + ~azure.mgmt.compute.v2020_09_30.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.id = None self.name = None @@ -3157,11 +3917,11 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -3176,6 +3936,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3196,8 +3963,8 @@ class PrivateLinkResource(msrest.serialization.Model): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -3223,6 +3990,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = None self.name = None @@ -3235,8 +4006,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateLinkResource] """ _attribute_map = { @@ -3249,6 +4020,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -3256,15 +4031,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -3281,6 +4056,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -3292,15 +4078,15 @@ class PurchasePlan(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The plan ID. - :type name: str - :param publisher: Required. The publisher ID. - :type publisher: str - :param product: Required. Specifies the product of the image from the marketplace. This is the + :ivar name: Required. The plan ID. + :vartype name: str + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar 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 - :param promotion_code: The Offer Promotion Code. - :type promotion_code: str + :vartype product: str + :ivar promotion_code: The Offer Promotion Code. + :vartype promotion_code: str """ _validation = { @@ -3325,6 +4111,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The Offer Promotion Code. + :paramtype promotion_code: str + """ super(PurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3335,10 +4132,10 @@ def __init__( class RecommendedMachineConfiguration(msrest.serialization.Model): """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange """ _attribute_map = { @@ -3353,6 +4150,12 @@ def __init__( memory: Optional["ResourceRange"] = None, **kwargs ): + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2020_09_30.models.ResourceRange + """ super(RecommendedMachineConfiguration, self).__init__(**kwargs) self.v_cp_us = v_cp_us self.memory = memory @@ -3392,6 +4195,8 @@ def __init__( self, **kwargs ): + """ + """ super(RegionalReplicationStatus, self).__init__(**kwargs) self.region = None self.state = None @@ -3427,6 +4232,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = None @@ -3435,10 +4242,10 @@ def __init__( class ResourceRange(msrest.serialization.Model): """Describes the resource range. - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int """ _attribute_map = { @@ -3453,6 +4260,12 @@ def __init__( max: Optional[int] = None, **kwargs ): + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ super(ResourceRange, self).__init__(**kwargs) self.min = min self.max = max @@ -3463,12 +4276,12 @@ class ResourceUriList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + :ivar value: Required. A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + :vartype value: list[str] + :ivar next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3487,6 +4300,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + disk encryption set. + :paramtype value: list[str] + :keyword next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + this to fetch the next page of encrypted resources. + :paramtype next_link: str + """ super(ResourceUriList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3501,8 +4322,8 @@ class SharedGallery(PirSharedGalleryResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str """ _validation = { @@ -3522,6 +4343,10 @@ def __init__( unique_id: Optional[str] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ super(SharedGallery, self).__init__(unique_id=unique_id, **kwargs) @@ -3534,35 +4359,35 @@ class SharedGalleryImage(PirSharedGalleryResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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.v2020_09_30.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan """ _validation = { @@ -3600,6 +4425,37 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemStateTypes + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2020_09_30.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2020_09_30.models.Disallowed + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2020_09_30.models.GalleryImageFeature] + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.ImagePurchasePlan + """ super(SharedGalleryImage, self).__init__(unique_id=unique_id, **kwargs) self.os_type = os_type self.os_state = os_state @@ -3617,11 +4473,11 @@ class SharedGalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of shared gallery images. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImage] - :param next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with + :ivar value: Required. A list of shared gallery images. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImage] + :ivar next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with this to fetch the next page of shared gallery images. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3640,6 +4496,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of shared gallery images. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImage] + :keyword next_link: The uri to fetch the next page of shared gallery images. Call ListNext() + with this to fetch the next page of shared gallery images. + :paramtype next_link: str + """ super(SharedGalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3654,14 +4517,14 @@ class SharedGalleryImageVersion(PirSharedGalleryResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version Definition. This + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + :ivar published_date: The published date of the gallery image version Definition. This property + can be used for decommissioning purposes. This property is updatable. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime + :vartype end_of_life_date: ~datetime.datetime """ _validation = { @@ -3685,6 +4548,16 @@ def __init__( end_of_life_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + :keyword published_date: The published date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype published_date: ~datetime.datetime + :keyword end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + """ super(SharedGalleryImageVersion, self).__init__(unique_id=unique_id, **kwargs) self.published_date = published_date self.end_of_life_date = end_of_life_date @@ -3695,11 +4568,11 @@ class SharedGalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of shared gallery images versions. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersion] - :param next_link: The uri to fetch the next page of shared gallery image versions. Call + :ivar value: Required. A list of shared gallery images versions. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersion] + :ivar next_link: The uri to fetch the next page of shared gallery image versions. Call ListNext() with this to fetch the next page of shared gallery image versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3718,6 +4591,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of shared gallery images versions. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersion] + :keyword next_link: The uri to fetch the next page of shared gallery image versions. Call + ListNext() with this to fetch the next page of shared gallery image versions. + :paramtype next_link: str + """ super(SharedGalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3728,11 +4608,11 @@ class SharedGalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of shared galleries. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGallery] - :param next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this + :ivar value: Required. A list of shared galleries. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGallery] + :ivar next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this to fetch the next page of shared galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3751,6 +4631,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of shared galleries. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.SharedGallery] + :keyword next_link: The uri to fetch the next page of shared galleries. Call ListNext() with + this to fetch the next page of shared galleries. + :paramtype next_link: str + """ super(SharedGalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3777,6 +4664,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareInfoElement, self).__init__(**kwargs) self.vm_uri = None @@ -3786,10 +4675,11 @@ class SharingProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param permissions: This property allows you to specify the permission of sharing gallery. + :ivar permissions: This property allows you to specify the permission of sharing gallery. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** :code:`
    `:code:`
    ` **Groups**. Possible values include: "Private", "Groups". - :type permissions: str or ~azure.mgmt.compute.v2020_09_30.models.GallerySharingPermissionTypes + :vartype permissions: str or + ~azure.mgmt.compute.v2020_09_30.models.GallerySharingPermissionTypes :ivar groups: A list of sharing profile groups. :vartype groups: list[~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroup] """ @@ -3809,6 +4699,13 @@ def __init__( permissions: Optional[Union[str, "GallerySharingPermissionTypes"]] = None, **kwargs ): + """ + :keyword permissions: This property allows you to specify the permission of sharing gallery. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** + :code:`
    `:code:`
    ` **Groups**. Possible values include: "Private", "Groups". + :paramtype permissions: str or + ~azure.mgmt.compute.v2020_09_30.models.GallerySharingPermissionTypes + """ super(SharingProfile, self).__init__(**kwargs) self.permissions = permissions self.groups = None @@ -3817,13 +4714,13 @@ def __init__( class SharingProfileGroup(msrest.serialization.Model): """Group of the gallery sharing profile. - :param type: This property allows you to specify the type of sharing group. + :ivar type: This property allows you to specify the type of sharing group. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** :code:`
    `:code:`
    ` **AADTenants**. Possible values include: "Subscriptions", "AADTenants". - :type type: str or ~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroupTypes - :param ids: A list of subscription/tenant ids the gallery is aimed to be shared to. - :type ids: list[str] + :vartype type: str or ~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroupTypes + :ivar ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :vartype ids: list[str] """ _attribute_map = { @@ -3838,6 +4735,15 @@ def __init__( ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword type: This property allows you to specify the type of sharing group. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** + :code:`
    `:code:`
    ` **AADTenants**. Possible values include: "Subscriptions", + "AADTenants". + :paramtype type: str or ~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroupTypes + :keyword ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :paramtype ids: list[str] + """ super(SharingProfileGroup, self).__init__(**kwargs) self.type = type self.ids = ids @@ -3848,13 +4754,14 @@ class SharingUpdate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operation_type: Required. This property allows you to specify the operation type of + :ivar operation_type: Required. This property allows you to specify the operation type of gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset**. Possible values include: "Add", "Remove", "Reset". - :type operation_type: str or ~azure.mgmt.compute.v2020_09_30.models.SharingUpdateOperationTypes - :param groups: A list of sharing profile groups. - :type groups: list[~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroup] + :vartype operation_type: str or + ~azure.mgmt.compute.v2020_09_30.models.SharingUpdateOperationTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroup] """ _validation = { @@ -3873,6 +4780,16 @@ def __init__( groups: Optional[List["SharingProfileGroup"]] = None, **kwargs ): + """ + :keyword operation_type: Required. This property allows you to specify the operation type of + gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` + **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset**. Possible values + include: "Add", "Remove", "Reset". + :paramtype operation_type: str or + ~azure.mgmt.compute.v2020_09_30.models.SharingUpdateOperationTypes + :keyword groups: A list of sharing profile groups. + :paramtype groups: list[~azure.mgmt.compute.v2020_09_30.models.SharingProfileGroup] + """ super(SharingUpdate, self).__init__(**kwargs) self.operation_type = operation_type self.groups = groups @@ -3891,37 +4808,37 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku - :param extended_location: The extended location where the snapshot will be created. Extended + :vartype sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku + :ivar extended_location: The extended location where the snapshot will be created. Extended location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation + :vartype extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation :ivar time_created: The time when the snapshot was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the image from which the source disk for - the snapshot was originally created. - :type purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the image from which the source disk for the + snapshot was originally created. + :vartype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", @@ -3929,23 +4846,24 @@ class Snapshot(Resource): :vartype disk_state: str or ~azure.mgmt.compute.v2020_09_30.models.DiskState :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _validation = { @@ -4006,6 +4924,52 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku + :keyword extended_location: The extended location where the snapshot will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2020_09_30.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_09_30.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the image from which the source disk for + the snapshot was originally created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_09_30.models.PurchasePlan + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_09_30.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -4032,11 +4996,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_09_30.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2020_09_30.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -4055,6 +5019,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2020_09_30.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4065,9 +5036,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_09_30.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_09_30.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -4087,6 +5058,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_09_30.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -4095,31 +5071,32 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str """ _attribute_map = { @@ -4146,6 +5123,35 @@ def __init__( disk_access_id: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2020_09_30.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_09_30.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_09_30.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_09_30.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_09_30.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -4160,8 +5166,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -4174,6 +5180,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -4183,18 +5193,18 @@ class TargetRegion(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per + :ivar name: Required. The name of the region. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. + :vartype regional_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType - :param encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :type encryption: ~azure.mgmt.compute.v2020_09_30.models.EncryptionImages + :vartype storage_account_type: str or ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS + and data disks in the gallery artifact. + :vartype encryption: ~azure.mgmt.compute.v2020_09_30.models.EncryptionImages """ _validation = { @@ -4217,6 +5227,21 @@ def __init__( encryption: Optional["EncryptionImages"] = None, **kwargs ): + """ + :keyword name: Required. The name of the region. + :paramtype name: str + :keyword regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :paramtype regional_replica_count: int + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_09_30.models.StorageAccountType + :keyword encryption: Optional. Allows users to provide customer managed keys for encrypting the + OS and data disks in the gallery artifact. + :paramtype encryption: ~azure.mgmt.compute.v2020_09_30.models.EncryptionImages + """ super(TargetRegion, self).__init__(**kwargs) self.name = name self.regional_replica_count = regional_replica_count @@ -4229,16 +5254,16 @@ class UserArtifactManage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param install: Required. Required. The path and arguments to install the gallery application. + :ivar install: Required. Required. The path and arguments to install the gallery application. This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. + :vartype install: str + :ivar remove: Required. Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not + :vartype remove: str + :ivar update: Optional. The path and arguments to update the gallery application. If not present, then update operation will invoke remove command on the previous version and install command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str + :vartype update: str """ _validation = { @@ -4260,6 +5285,18 @@ def __init__( update: Optional[str] = None, **kwargs ): + """ + :keyword install: Required. Required. The path and arguments to install the gallery + application. This is limited to 4096 characters. + :paramtype install: str + :keyword remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :paramtype remove: str + :keyword update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :paramtype update: str + """ super(UserArtifactManage, self).__init__(**kwargs) self.install = install self.remove = remove @@ -4271,12 +5308,12 @@ class UserArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + :ivar media_link: Required. Required. The mediaLink of the artifact, must be a readable storage + page blob. + :vartype media_link: str + :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. - :type default_configuration_link: str + :vartype default_configuration_link: str """ _validation = { @@ -4295,6 +5332,14 @@ def __init__( default_configuration_link: Optional[str] = None, **kwargs ): + """ + :keyword media_link: Required. Required. The mediaLink of the artifact, must be a readable + storage page blob. + :paramtype media_link: str + :keyword default_configuration_link: Optional. The defaultConfigurationLink of the artifact, + must be a readable storage page blob. + :paramtype default_configuration_link: str + """ super(UserArtifactSource, self).__init__(**kwargs) self.media_link = media_link self.default_configuration_link = default_configuration_link diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py index 3aa92eb9c69e..363282b9cd4b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py @@ -5,25 +5,440 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_a_private_endpoint_connection_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_endpoint_connections_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskAccessesOperations(object): """DiskAccessesOperations operations. @@ -49,43 +464,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -103,16 +507,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. @@ -125,15 +531,18 @@ def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_09_30.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +554,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +580,37 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -235,16 +628,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. @@ -257,15 +652,18 @@ def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_09_30.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +675,21 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +701,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.DiskAccess": """Gets information about a disk access resource. :param resource_group_name: The name of the resource group. @@ -336,27 +729,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +753,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,13 +791,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk access resource. :param resource_group_name: The name of the resource group. @@ -434,15 +809,17 @@ def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -456,21 +833,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -482,14 +852,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a resource group. :param resource_group_name: The name of the resource group. @@ -504,35 +875,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -550,16 +917,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -572,34 +940,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -617,18 +980,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def get_private_link_resources( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources possible under disk access resource. :param resource_group_name: The name of the resource group. @@ -647,27 +1011,17 @@ def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -681,49 +1035,40 @@ def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + def _update_a_private_endpoint_connection_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - 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 @@ -741,17 +1086,19 @@ def _update_a_private_endpoint_connection_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_update_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. @@ -765,18 +1112,24 @@ def begin_update_a_private_endpoint_connection( :type private_endpoint_connection_name: str :param private_endpoint_connection: private endpoint connection object supplied in the body of the Put private endpoint connection operation. - :type private_endpoint_connection: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -789,28 +1142,21 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -822,16 +1168,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def get_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets information about a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. @@ -852,28 +1199,18 @@ def get_a_private_endpoint_connection( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get_a_private_endpoint_connection.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -887,43 +1224,34 @@ def get_a_private_endpoint_connection( return cls(pipeline_response, deserialized, {}) return deserialized + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_a_private_endpoint_connection_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -936,14 +1264,15 @@ def _delete_a_private_endpoint_connection_initial( _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. @@ -956,15 +1285,17 @@ def begin_delete_a_private_endpoint_connection( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -979,22 +1310,14 @@ def begin_delete_a_private_endpoint_connection( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1006,15 +1329,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_private_endpoint_connections( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List information about private endpoint connections under a disk access resource. :param resource_group_name: The name of the resource group. @@ -1024,8 +1348,10 @@ def list_private_endpoint_connections( are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -1033,36 +1359,33 @@ def list_private_endpoint_connections( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_private_endpoint_connections.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1080,6 +1403,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py index 9e61624b5c8a..928a1f2ce979 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py @@ -5,25 +5,285 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_associated_resources_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskEncryptionSetsOperations(object): """DiskEncryptionSetsOperations operations. @@ -49,43 +309,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -103,16 +352,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. @@ -126,15 +377,19 @@ def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,27 +401,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,47 +427,37 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -236,16 +475,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. @@ -259,15 +500,19 @@ def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +524,21 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,15 +550,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. @@ -338,27 +578,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,41 +602,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,13 +640,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. @@ -436,15 +658,17 @@ def begin_delete( :type disk_encryption_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -458,21 +682,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -484,21 +701,24 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption 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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -506,35 +726,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,21 +768,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -574,34 +793,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -619,18 +833,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceUriList"] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceUriList"]: """Lists all resources that are encrypted with this disk encryption set. :param resource_group_name: The name of the resource group. @@ -649,36 +864,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -696,6 +908,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py index 752e0598d153..636def144e46 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py @@ -5,23 +5,101 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_restore_point_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskRestorePointOperations(object): """DiskRestorePointOperations operations. @@ -45,15 +123,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskRestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> "_models.DiskRestorePoint": """Get disk restorePoint resource. :param resource_group_name: The name of the resource group. @@ -79,29 +157,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,16 +183,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + @distributed_trace def list_by_restore_point( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskRestorePointList"] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskRestorePointList"]: """Lists diskRestorePoints under a vmRestorePoint. :param resource_group_name: The name of the resource group. @@ -138,8 +208,10 @@ def list_by_restore_point( 80 characters. :type vm_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskRestorePointList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePointList] + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] @@ -147,37 +219,35 @@ def list_by_restore_point( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_restore_point.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, '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) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskRestorePointList', pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -195,6 +265,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py index 0ff9c8e72298..e8900f3a8e13 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_09_30.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2020_09_30.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py index 85d74ca2f37a..436ca8066ef9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py @@ -5,25 +5,254 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + select: Optional[Union[str, "_models.SelectPermissions"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleriesOperations(object): """GalleriesOperations operations. @@ -49,43 +278,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -106,16 +324,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Create or update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -127,15 +347,18 @@ def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2020_09_30.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +370,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,47 +396,37 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -233,16 +440,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -254,15 +463,18 @@ def begin_update( :type gallery: ~azure.mgmt.compute.v2020_09_30.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,27 +486,21 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -306,16 +512,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - select=None, # type: Optional[Union[str, "_models.SelectPermissions"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + select: Optional[Union[str, "_models.SelectPermissions"]] = None, + **kwargs: Any + ) -> "_models.Gallery": """Retrieves information about a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -334,29 +541,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + select=select, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +566,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,13 +604,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -432,15 +620,17 @@ def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +644,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +663,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +686,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +728,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +751,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +791,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py index 17d770d9999e..01cd1feb2bde 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_application_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationVersionsOperations(object): """GalleryApplicationVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -139,18 +348,24 @@ def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +379,21 @@ def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +405,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -256,18 +453,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -285,18 +484,24 @@ def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +515,21 @@ def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +541,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": """Retrieves information about a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -381,31 +579,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,45 +606,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -470,15 +648,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -494,15 +673,17 @@ def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -518,23 +699,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -546,16 +718,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationVersionList"]: """List gallery Application Versions in a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -567,8 +740,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -576,37 +751,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -624,6 +797,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py index b05fac6dfd6a..24c32509b727 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationsOperations(object): """GalleryApplicationsOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -135,15 +330,20 @@ def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -156,28 +356,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,49 +382,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -245,17 +428,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -271,15 +456,20 @@ def begin_update( :type gallery_application: ~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +482,21 @@ def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,16 +508,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> "_models.GalleryApplication": """Retrieves information about a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -355,28 +539,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,43 +564,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -439,14 +604,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application. :param resource_group_name: The name of the resource group. @@ -458,15 +624,17 @@ def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -481,22 +649,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -508,15 +668,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationList"]: """List gallery Application Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -525,8 +686,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -534,36 +697,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -581,6 +741,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py index c69e3d1c2176..c1faa55c45a9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_image_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImageVersionsOperations(object): """GalleryImageVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Create or update a gallery image version. :param resource_group_name: The name of the resource group. @@ -142,15 +351,20 @@ def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +378,21 @@ def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +404,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -256,18 +452,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Update a gallery image version. :param resource_group_name: The name of the resource group. @@ -288,15 +486,20 @@ def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +513,21 @@ def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +539,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": """Retrieves information about a gallery image version. :param resource_group_name: The name of the resource group. @@ -380,31 +576,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -418,45 +603,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -469,15 +645,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image version. :param resource_group_name: The name of the resource group. @@ -492,15 +669,17 @@ def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -516,23 +695,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,16 +714,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageVersionList"]: """List gallery image versions in a gallery image definition. :param resource_group_name: The name of the resource group. @@ -565,8 +736,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -574,37 +747,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -622,6 +793,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py index 7334182cd9a6..533642b7d107 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImagesOperations(object): """GalleryImagesOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. @@ -134,15 +329,19 @@ def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,28 +354,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -188,49 +380,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Update a gallery image definition. :param resource_group_name: The name of the resource group. @@ -270,15 +454,19 @@ def begin_update( :type gallery_image: ~azure.mgmt.compute.v2020_09_30.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +479,21 @@ def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,16 +505,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": """Retrieves information about a gallery image definition. :param resource_group_name: The name of the resource group. @@ -353,28 +535,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,43 +560,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,14 +600,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image. :param resource_group_name: The name of the resource group. @@ -456,15 +620,17 @@ def begin_delete( :type gallery_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,22 +645,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -506,15 +664,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageList"]: """List gallery image definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -532,36 +691,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -579,6 +735,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py index 96eb2a2aa712..09659ceecb3d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py @@ -5,24 +5,71 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class GallerySharingProfileOperations(object): """GallerySharingProfileOperations operations. @@ -48,43 +95,32 @@ def __init__(self, client, config, serializer, deserializer): def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - sharing_update, # type: "_models.SharingUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.SharingUpdate" + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> "_models.SharingUpdate": cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(sharing_update, 'SharingUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sharing_update, 'SharingUpdate') - 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 @@ -102,16 +138,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - sharing_update, # type: "_models.SharingUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SharingUpdate"] + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> LROPoller["_models.SharingUpdate"]: """Update sharing profile of a gallery. :param resource_group_name: The name of the resource group. @@ -122,15 +160,19 @@ def begin_update( :type sharing_update: ~azure.mgmt.compute.v2020_09_30.models.SharingUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SharingUpdate or the result of cls(response) + :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 SharingUpdate or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -142,27 +184,21 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, sharing_update=sharing_update, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SharingUpdate', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -174,4 +210,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py index 119594762ecd..37f8152da32b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py @@ -5,23 +5,97 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharedGalleriesOperations(object): """SharedGalleriesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - shared_to=None, # type: Optional[Union[str, "_models.SharedToValues"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SharedGalleryList"] + location: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryList"]: """List shared galleries by subscription id or tenant id. :param location: Resource location. @@ -69,37 +143,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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'), - 'location': self._serialize.url("location", location, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryList', pipeline_response) + deserialized = self._deserialize("SharedGalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,18 +187,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries'} # type: ignore + @distributed_trace def get( self, - location, # type: str - gallery_unique_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedGallery" + location: str, + gallery_unique_name: str, + **kwargs: Any + ) -> "_models.SharedGallery": """Get a shared gallery by subscription id or tenant id. :param location: Resource location. @@ -145,27 +216,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,4 +240,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py index 517d6a81be3b..afa55f7cfb96 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py @@ -5,23 +5,105 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharedGalleryImageVersionsOperations(object): """SharedGalleryImageVersionsOperations operations. @@ -45,15 +127,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - gallery_unique_name, # type: str - gallery_image_name, # type: str - shared_to=None, # type: Optional[Union[str, "_models.SharedToValues"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SharedGalleryImageVersionList"] + location: str, + gallery_unique_name: str, + gallery_image_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryImageVersionList"]: """List shared gallery image versions by subscription id or tenant id. :param location: Resource location. @@ -67,8 +149,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersionList] + :return: An iterator like instance of either SharedGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] @@ -76,39 +160,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,20 +208,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions'} # type: ignore + @distributed_trace def get( self, - location, # type: str - gallery_unique_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedGalleryImageVersion" + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImageVersion": """Get a shared gallery image version by subscription id or tenant id. :param location: Resource location. @@ -164,29 +247,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -200,4 +273,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py index df928f00d497..c6f6f2a52123 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py @@ -5,23 +5,101 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharedGalleryImagesOperations(object): """SharedGalleryImagesOperations operations. @@ -45,14 +123,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - gallery_unique_name, # type: str - shared_to=None, # type: Optional[Union[str, "_models.SharedToValues"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SharedGalleryImageList"] + location: str, + gallery_unique_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryImageList"]: """List shared gallery images by subscription id or tenant id. :param location: Resource location. @@ -63,8 +141,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageList] + :return: An iterator like instance of either SharedGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] @@ -72,38 +152,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,19 +198,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images'} # type: ignore + @distributed_trace def get( self, - location, # type: str - gallery_unique_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedGalleryImage" + location: str, + gallery_unique_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImage": """Get a shared gallery image by subscription id or tenant id. :param location: Resource location. @@ -153,28 +231,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,4 +256,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py index cd178bebb4c8..fe15c9607cc0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-30" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-30" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_09_30.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_09_30.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-30" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_09_30.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-09-30" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py index 343a02280505..4c88f462a55c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py @@ -6,89 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import CloudServiceRoleInstancesOperations, CloudServiceRolesOperations, CloudServicesOperations, CloudServicesUpdateDomainOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import CloudServiceRoleInstancesOperations -from .operations import CloudServiceRolesOperations -from .operations import CloudServicesOperations -from .operations import CloudServicesUpdateDomainOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations - :vartype cloud_service_role_instances: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServiceRoleInstancesOperations + :vartype cloud_service_role_instances: + azure.mgmt.compute.v2020_10_01_preview.operations.CloudServiceRoleInstancesOperations :ivar cloud_service_roles: CloudServiceRolesOperations operations - :vartype cloud_service_roles: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServiceRolesOperations + :vartype cloud_service_roles: + azure.mgmt.compute.v2020_10_01_preview.operations.CloudServiceRolesOperations :ivar cloud_services: CloudServicesOperations operations - :vartype cloud_services: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServicesOperations + :vartype cloud_services: + azure.mgmt.compute.v2020_10_01_preview.operations.CloudServicesOperations :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations - :vartype cloud_services_update_domain: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServicesUpdateDomainOperations + :vartype cloud_services_update_domain: + azure.mgmt.compute.v2020_10_01_preview.operations.CloudServicesUpdateDomainOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_service_roles = CloudServiceRolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services = CloudServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations(self._client, self._config, self._serialize, self._deserialize) - self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_service_roles = CloudServiceRolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services = CloudServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py index 13c3d26765d1..d555505a76bc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json index 096a4180fb15..119180b2f4e0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "cloud_service_role_instances": "CloudServiceRoleInstancesOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py index 3f380e7bf049..5cbb578ec5de 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py @@ -6,85 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import CloudServiceRoleInstancesOperations, CloudServiceRolesOperations, CloudServicesOperations, CloudServicesUpdateDomainOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import CloudServiceRoleInstancesOperations -from .operations import CloudServiceRolesOperations -from .operations import CloudServicesOperations -from .operations import CloudServicesUpdateDomainOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations - :vartype cloud_service_role_instances: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServiceRoleInstancesOperations + :vartype cloud_service_role_instances: + azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServiceRoleInstancesOperations :ivar cloud_service_roles: CloudServiceRolesOperations operations - :vartype cloud_service_roles: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServiceRolesOperations + :vartype cloud_service_roles: + azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServiceRolesOperations :ivar cloud_services: CloudServicesOperations operations - :vartype cloud_services: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServicesOperations + :vartype cloud_services: + azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServicesOperations :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations - :vartype cloud_services_update_domain: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServicesUpdateDomainOperations + :vartype cloud_services_update_domain: + azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServicesUpdateDomainOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_service_roles = CloudServiceRolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services = CloudServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations(self._client, self._config, self._serialize, self._deserialize) - self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_service_roles = CloudServiceRolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services = CloudServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py index 6c5cfb021b25..0cc835b99229 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py index 4e5d978fe097..fe959c0e315d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, IO, 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_service_role_instances_operations import build_delete_request_initial, build_get_instance_view_request, build_get_remote_desktop_file_request, build_get_request, build_list_request, build_rebuild_request_initial, build_reimage_request_initial, build_restart_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -89,6 +84,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, role_instance_name: str, @@ -106,15 +103,17 @@ async def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -129,22 +128,14 @@ async def begin_delete( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -156,8 +147,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + @distributed_trace_async async def get( self, role_instance_name: str, @@ -174,7 +167,8 @@ async def get( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. + :param expand: The expand expression to apply to the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) @@ -186,30 +180,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -223,8 +206,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, role_instance_name: str, @@ -250,28 +236,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_instance_view.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -285,8 +261,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -302,11 +281,14 @@ def list( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. + :param expand: The expand expression to apply to the operation. The default value is + "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 RoleInstanceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] + :return: An iterator like instance of either RoleInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] @@ -314,38 +296,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleInstanceListResult', pipeline_response) + deserialized = self._deserialize("RoleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -363,6 +342,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -380,28 +360,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_restart_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -414,6 +384,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, role_instance_name: str, @@ -432,15 +404,17 @@ async def begin_restart( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -455,22 +429,14 @@ async def begin_restart( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -482,6 +448,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore async def _reimage_initial( @@ -496,28 +463,18 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._reimage_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_reimage_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -530,6 +487,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, role_instance_name: str, @@ -548,15 +507,17 @@ async def begin_reimage( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -571,22 +532,14 @@ async def begin_reimage( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -598,6 +551,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore async def _rebuild_initial( @@ -612,28 +566,18 @@ async def _rebuild_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_rebuild_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -646,6 +590,8 @@ async def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + @distributed_trace_async async def begin_rebuild( self, role_instance_name: str, @@ -665,15 +611,17 @@ async def begin_rebuild( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -688,22 +636,14 @@ async def begin_rebuild( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -715,8 +655,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + @distributed_trace_async async def get_remote_desktop_file( self, role_instance_name: str, @@ -742,28 +684,18 @@ async def get_remote_desktop_file( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/x-rdp" - - # Construct URL - url = self.get_remote_desktop_file.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_remote_desktop_file_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_remote_desktop_file.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) response = pipeline_response.http_response @@ -777,4 +709,6 @@ async def get_remote_desktop_file( return cls(pipeline_response, deserialized, {}) return deserialized + get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py index e9e0a77379cb..54aa12d87d13 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_service_roles_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, role_name: str, @@ -66,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_name=role_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +97,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -117,8 +116,10 @@ def list( :param cloud_service_name: :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceRoleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] + :return: An iterator like instance of either CloudServiceRoleListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] @@ -126,36 +127,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceRoleListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceRoleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -173,6 +171,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py index 23bf32b7a1ed..cf11d744dd9b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_services_operations import build_create_or_update_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_all_request, build_list_request, build_power_off_request_initial, build_rebuild_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,35 +60,25 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudService') + _json = self._serialize.body(parameters, 'CloudService') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CloudService or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CloudService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +144,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,6 +170,7 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}'} # type: ignore async def _update_initial( @@ -187,35 +185,25 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudServiceUpdate') + _json = self._serialize.body(parameters, 'CloudServiceUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -248,15 +239,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CloudService or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CloudService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -268,27 +264,21 @@ async def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -300,6 +290,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore async def _delete_initial( @@ -313,27 +304,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -346,6 +327,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -360,15 +343,17 @@ async def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,21 +367,14 @@ async def begin_delete( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -408,8 +386,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -432,27 +412,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +436,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -490,27 +463,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -524,8 +487,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + + @distributed_trace def list_all( self, **kwargs: Any @@ -535,8 +501,10 @@ def list_all( till nextLink is null to fetch all the Cloud Services. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -544,34 +512,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -589,11 +552,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -606,8 +571,10 @@ def list( :param resource_group_name: 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 CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -615,35 +582,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -661,6 +624,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -677,27 +641,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_start_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -710,6 +664,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -724,15 +680,17 @@ async def begin_start( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -746,21 +704,14 @@ async def begin_start( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -772,6 +723,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore async def _power_off_initial( @@ -785,27 +737,17 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -818,6 +760,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -833,15 +777,17 @@ async def begin_power_off( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -855,21 +801,14 @@ async def begin_power_off( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -881,6 +820,7 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/poweroff'} # type: ignore async def _restart_initial( @@ -895,35 +835,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -936,6 +866,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -953,15 +885,18 @@ async def begin_restart( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -973,24 +908,18 @@ async def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1002,6 +931,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore async def _reimage_initial( @@ -1016,35 +946,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1057,6 +977,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1075,15 +997,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1095,24 +1020,18 @@ async def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1124,6 +1043,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore async def _rebuild_initial( @@ -1138,35 +1058,25 @@ async def _rebuild_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_rebuild_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1179,6 +1089,8 @@ async def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + @distributed_trace_async async def begin_rebuild( self, resource_group_name: str, @@ -1198,15 +1110,18 @@ async def begin_rebuild( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1218,24 +1133,18 @@ async def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1247,6 +1156,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore async def _delete_instances_initial( @@ -1261,35 +1171,25 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1302,6 +1202,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -1319,15 +1221,18 @@ async def begin_delete_instances( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1339,24 +1244,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1368,4 +1267,5 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/delete'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py index 191db1654a26..0fdf7bc5cbda 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_services_update_domain_operations import build_get_update_domain_request, build_list_update_domains_request, build_walk_update_domain_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,36 +61,26 @@ async def _walk_update_domain_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._walk_update_domain_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateDomain') + _json = self._serialize.body(parameters, 'UpdateDomain') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_walk_update_domain_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._walk_update_domain_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,6 +93,8 @@ async def _walk_update_domain_initial( _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace_async async def begin_walk_update_domain( self, resource_group_name: str, @@ -120,15 +117,18 @@ async def begin_walk_update_domain( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -141,25 +141,18 @@ async def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,8 +164,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + @distributed_trace_async async def get_update_domain( self, resource_group_name: str, @@ -202,28 +197,18 @@ async def get_update_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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 = build_get_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + template_url=self.get_update_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +222,11 @@ async def get_update_domain( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace def list_update_domains( self, resource_group_name: str, @@ -252,8 +240,10 @@ def list_update_domains( :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UpdateDomainListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] + :return: An iterator like instance of either UpdateDomainListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] @@ -261,36 +251,33 @@ def list_update_domains( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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_update_domains.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_update_domains.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UpdateDomainListResult', pipeline_response) + deserialized = self._deserialize("UpdateDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -308,6 +295,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py index bfa6fa5f53c9..15828acce37a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py @@ -6,86 +6,46 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ApiError - from ._models_py3 import ApiErrorBase - from ._models_py3 import CloudService - from ._models_py3 import CloudServiceExtensionProfile - from ._models_py3 import CloudServiceExtensionProperties - from ._models_py3 import CloudServiceInstanceView - from ._models_py3 import CloudServiceListResult - from ._models_py3 import CloudServiceNetworkProfile - from ._models_py3 import CloudServiceOsProfile - from ._models_py3 import CloudServiceProperties - from ._models_py3 import CloudServiceRole - from ._models_py3 import CloudServiceRoleListResult - from ._models_py3 import CloudServiceRoleProfile - from ._models_py3 import CloudServiceRoleProfileProperties - from ._models_py3 import CloudServiceRoleProperties - from ._models_py3 import CloudServiceRoleSku - from ._models_py3 import CloudServiceUpdate - from ._models_py3 import CloudServiceVaultAndSecretReference - from ._models_py3 import CloudServiceVaultCertificate - from ._models_py3 import CloudServiceVaultSecretGroup - from ._models_py3 import Extension - from ._models_py3 import InnerError - from ._models_py3 import InstanceSku - from ._models_py3 import InstanceViewStatusesSummary - from ._models_py3 import LoadBalancerConfiguration - from ._models_py3 import LoadBalancerConfigurationProperties - from ._models_py3 import LoadBalancerFrontendIPConfiguration - from ._models_py3 import LoadBalancerFrontendIPConfigurationProperties - from ._models_py3 import ResourceInstanceViewStatus - 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 StatusCodeCount - from ._models_py3 import SubResource - from ._models_py3 import UpdateDomain - from ._models_py3 import UpdateDomainListResult -except (SyntaxError, ImportError): - from ._models import ApiError # type: ignore - from ._models import ApiErrorBase # type: ignore - from ._models import CloudService # type: ignore - from ._models import CloudServiceExtensionProfile # type: ignore - from ._models import CloudServiceExtensionProperties # type: ignore - from ._models import CloudServiceInstanceView # type: ignore - from ._models import CloudServiceListResult # type: ignore - from ._models import CloudServiceNetworkProfile # type: ignore - from ._models import CloudServiceOsProfile # type: ignore - from ._models import CloudServiceProperties # type: ignore - from ._models import CloudServiceRole # type: ignore - from ._models import CloudServiceRoleListResult # type: ignore - from ._models import CloudServiceRoleProfile # type: ignore - from ._models import CloudServiceRoleProfileProperties # type: ignore - from ._models import CloudServiceRoleProperties # type: ignore - from ._models import CloudServiceRoleSku # type: ignore - from ._models import CloudServiceUpdate # type: ignore - from ._models import CloudServiceVaultAndSecretReference # type: ignore - from ._models import CloudServiceVaultCertificate # type: ignore - from ._models import CloudServiceVaultSecretGroup # type: ignore - from ._models import Extension # type: ignore - from ._models import InnerError # type: ignore - from ._models import InstanceSku # type: ignore - from ._models import InstanceViewStatusesSummary # 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 ResourceInstanceViewStatus # 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 StatusCodeCount # type: ignore - from ._models import SubResource # type: ignore - from ._models import UpdateDomain # type: ignore - from ._models import UpdateDomainListResult # type: ignore +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import CloudService +from ._models_py3 import CloudServiceExtensionProfile +from ._models_py3 import CloudServiceExtensionProperties +from ._models_py3 import CloudServiceInstanceView +from ._models_py3 import CloudServiceListResult +from ._models_py3 import CloudServiceNetworkProfile +from ._models_py3 import CloudServiceOsProfile +from ._models_py3 import CloudServiceProperties +from ._models_py3 import CloudServiceRole +from ._models_py3 import CloudServiceRoleListResult +from ._models_py3 import CloudServiceRoleProfile +from ._models_py3 import CloudServiceRoleProfileProperties +from ._models_py3 import CloudServiceRoleProperties +from ._models_py3 import CloudServiceRoleSku +from ._models_py3 import CloudServiceUpdate +from ._models_py3 import CloudServiceVaultAndSecretReference +from ._models_py3 import CloudServiceVaultCertificate +from ._models_py3 import CloudServiceVaultSecretGroup +from ._models_py3 import Extension +from ._models_py3 import InnerError +from ._models_py3 import InstanceSku +from ._models_py3 import InstanceViewStatusesSummary +from ._models_py3 import LoadBalancerConfiguration +from ._models_py3 import LoadBalancerConfigurationProperties +from ._models_py3 import LoadBalancerFrontendIPConfiguration +from ._models_py3 import LoadBalancerFrontendIPConfigurationProperties +from ._models_py3 import ResourceInstanceViewStatus +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 StatusCodeCount +from ._models_py3 import SubResource +from ._models_py3 import UpdateDomain +from ._models_py3 import UpdateDomainListResult + from ._compute_management_client_enums import ( CloudServiceUpgradeMode, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py index 2335366377fd..701bbbd8b437 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CloudServiceUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 automatically in all update domains. @@ -41,7 +26,7 @@ class CloudServiceUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum MANUAL = "Manual" SIMULTANEOUS = "Simultaneous" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models.py deleted file mode 100644 index 82e445ddebce..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models.py +++ /dev/null @@ -1,1229 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ApiError(msrest.serialization.Model): - """Api error. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_10_01_preview.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_10_01_preview.models.InnerError - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', 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.v2020_10_01_preview.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.v2020_10_01_preview.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.v2020_10_01_preview.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.v2020_10_01_preview.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 statuses: - :vartype statuses: - list[~azure.mgmt.compute.v2020_10_01_preview.models.ResourceInstanceViewStatus] - """ - - _validation = { - 'sdk_version': {'readonly': True}, - 'statuses': {'readonly': True}, - } - - _attribute_map = { - 'role_instance': {'key': 'roleInstance', 'type': 'InstanceViewStatusesSummary'}, - 'sdk_version': {'key': 'sdkVersion', '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.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.v2020_10_01_preview.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: The list of load balancer configurations for the cloud - service. - :type load_balancer_configurations: - list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfiguration] - :param swappable_cloud_service: - :type swappable_cloud_service: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource - """ - - _attribute_map = { - 'load_balancer_configurations': {'key': 'loadBalancerConfigurations', 'type': '[LoadBalancerConfiguration]'}, - 'swappable_cloud_service': {'key': 'swappableCloudService', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudServiceNetworkProfile, self).__init__(**kwargs) - self.load_balancer_configurations = kwargs.get('load_balancer_configurations', None) - self.swappable_cloud_service = kwargs.get('swappable_cloud_service', None) - - -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.v2020_10_01_preview.models.CloudServiceVaultSecretGroup] - """ - - _attribute_map = { - 'secrets': {'key': 'secrets', 'type': '[CloudServiceVaultSecretGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudServiceOsProfile, self).__init__(**kwargs) - self.secrets = kwargs.get('secrets', None) - - -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 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.v2020_10_01_preview.models.CloudServiceUpgradeMode - :param role_profile: Describes the role profile for the cloud service. - :type role_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfile - :param os_profile: Describes the OS profile for the cloud service. - :type os_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceOsProfile - :param network_profile: Network Profile for the cloud service. - :type network_profile: - ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceNetworkProfile - :param extension_profile: Describes a cloud service extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2020_10_01_preview.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'}, - '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, - **kwargs - ): - super(CloudServiceProperties, self).__init__(**kwargs) - self.package_url = kwargs.get('package_url', None) - self.configuration = kwargs.get('configuration', None) - self.configuration_url = kwargs.get('configuration_url', None) - self.start_cloud_service = kwargs.get('start_cloud_service', None) - self.upgrade_mode = kwargs.get('upgrade_mode', None) - self.role_profile = kwargs.get('role_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - 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.v2020_10_01_preview.models.CloudServiceRoleSku - :param properties: - :type properties: ~azure.mgmt.compute.v2020_10_01_preview.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, - **kwargs - ): - super(CloudServiceRole, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.sku = kwargs.get('sku', None) - self.properties = kwargs.get('properties', None) - - -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.v2020_10_01_preview.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, - **kwargs - ): - super(CloudServiceRoleListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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.v2020_10_01_preview.models.CloudServiceRoleProfileProperties] - """ - - _attribute_map = { - 'roles': {'key': 'roles', 'type': '[CloudServiceRoleProfileProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudServiceRoleProfile, self).__init__(**kwargs) - self.roles = kwargs.get('roles', None) - - -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.v2020_10_01_preview.models.CloudServiceRoleSku - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.sku = kwargs.get('sku', None) - - -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, - **kwargs - ): - super(CloudServiceRoleSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - self.capacity = kwargs.get('capacity', None) - - -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, - **kwargs - ): - super(CloudServiceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class CloudServiceVaultAndSecretReference(msrest.serialization.Model): - """CloudServiceVaultAndSecretReference. - - :param source_vault: - :type source_vault: ~azure.mgmt.compute.v2020_10_01_preview.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, - **kwargs - ): - super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.secret_url = kwargs.get('secret_url', None) - - -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, - **kwargs - ): - super(CloudServiceVaultCertificate, self).__init__(**kwargs) - self.certificate_url = kwargs.get('certificate_url', None) - - -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.v2020_10_01_preview.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: - list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultCertificate] - """ - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, - 'vault_certificates': {'key': 'vaultCertificates', 'type': '[CloudServiceVaultCertificate]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.vault_certificates = kwargs.get('vault_certificates', 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.v2020_10_01_preview.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 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 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.v2020_10_01_preview.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 LoadBalancerConfiguration(msrest.serialization.Model): - """Describes the load balancer configuration. - - :param name: Resource Name. - :type name: str - :param properties: - :type properties: - ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfigurationProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LoadBalancerConfigurationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancerConfiguration, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.properties = kwargs.get('properties', None) - - -class LoadBalancerConfigurationProperties(msrest.serialization.Model): - """LoadBalancerConfigurationProperties. - - :param frontend_ip_configurations: List of IP. - :type frontend_ip_configurations: - list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfiguration] - """ - - _attribute_map = { - 'frontend_ip_configurations': {'key': 'frontendIPConfigurations', 'type': '[LoadBalancerFrontendIPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) - self.frontend_ip_configurations = kwargs.get('frontend_ip_configurations', None) - - -class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): - """LoadBalancerFrontendIPConfiguration. - - :param name: - :type name: str - :param properties: Describes a cloud service IP Configuration. - :type properties: - ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfigurationProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LoadBalancerFrontendIPConfigurationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.properties = kwargs.get('properties', None) - - -class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): - """Describes a cloud service IP Configuration. - - :param public_ip_address: - :type public_ip_address: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource - :param subnet: - :type subnet: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource - :param private_ip_address: The private IP address referenced by the cloud service. - :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 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.v2020_10_01_preview.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 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.v2020_10_01_preview.models.InstanceSku - :param properties: - :type properties: ~azure.mgmt.compute.v2020_10_01_preview.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.v2020_10_01_preview.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.v2020_10_01_preview.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.v2020_10_01_preview.models.RoleInstanceNetworkProfile - :param instance_view: The instance view of the role instance. - :type instance_view: ~azure.mgmt.compute.v2020_10_01_preview.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.v2020_10_01_preview.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 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 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 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.v2020_10_01_preview.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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py index 81684f142e8d..8d38419de26a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py @@ -16,16 +16,16 @@ class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_10_01_preview.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_10_01_preview.models.InnerError - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2020_10_01_preview.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2020_10_01_preview.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str """ _attribute_map = { @@ -46,6 +46,18 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2020_10_01_preview.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2020_10_01_preview.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + :keyword target: The target of the particular error. + :paramtype target: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -57,12 +69,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str """ _attribute_map = { @@ -79,6 +91,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + :keyword target: The target of the particular error. + :paramtype target: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.message = message @@ -98,12 +118,12 @@ class CloudService(msrest.serialization.Model): :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.v2020_10_01_preview.models.CloudServiceProperties + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Cloud service properties. + :vartype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceProperties """ _validation = { @@ -130,6 +150,14 @@ def __init__( properties: Optional["CloudServiceProperties"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Cloud service properties. + :paramtype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceProperties + """ super(CloudService, self).__init__(**kwargs) self.id = None self.name = None @@ -142,8 +170,8 @@ def __init__( 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.v2020_10_01_preview.models.Extension] + :ivar extensions: List of extensions for the cloud service. + :vartype extensions: list[~azure.mgmt.compute.v2020_10_01_preview.models.Extension] """ _attribute_map = { @@ -156,6 +184,10 @@ def __init__( extensions: Optional[List["Extension"]] = None, **kwargs ): + """ + :keyword extensions: List of extensions for the cloud service. + :paramtype extensions: list[~azure.mgmt.compute.v2020_10_01_preview.models.Extension] + """ super(CloudServiceExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -165,32 +197,32 @@ class CloudServiceExtensionProperties(msrest.serialization.Model): 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 + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension. + :vartype type: str + :ivar 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 + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Explicitly specify whether platform can automatically upgrade + typeHandlerVersion to higher minor versions when they become available. + :vartype auto_upgrade_minor_version: bool + :ivar 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 + :vartype settings: str + :ivar 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: + :vartype protected_settings: str + :ivar protected_settings_from_key_vault: + :vartype protected_settings_from_key_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultAndSecretReference - :param force_update_tag: Tag to force apply the provided public and protected settings. + :ivar 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 @@ -198,12 +230,12 @@ class CloudServiceExtensionProperties(msrest.serialization.Model): 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 + :vartype 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 + :ivar 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] + :vartype roles_applied_to: list[str] """ _validation = { @@ -237,6 +269,45 @@ def __init__( roles_applied_to: Optional[List[str]] = None, **kwargs ): + """ + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension. + :paramtype type: str + :keyword 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. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Explicitly specify whether platform can automatically + upgrade typeHandlerVersion to higher minor versions when they become available. + :paramtype auto_upgrade_minor_version: bool + :keyword 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. + :paramtype settings: str + :keyword protected_settings: Protected settings for the extension which are encrypted before + sent to the role instance. + :paramtype protected_settings: str + :keyword protected_settings_from_key_vault: + :paramtype protected_settings_from_key_vault: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultAndSecretReference + :keyword 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. + :paramtype force_update_tag: str + :keyword 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. + :paramtype roles_applied_to: list[str] + """ super(CloudServiceExtensionProperties, self).__init__(**kwargs) self.publisher = publisher self.type = type @@ -255,8 +326,9 @@ class CloudServiceInstanceView(msrest.serialization.Model): 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.v2020_10_01_preview.models.InstanceViewStatusesSummary + :ivar role_instance: Instance view statuses. + :vartype role_instance: + ~azure.mgmt.compute.v2020_10_01_preview.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 @@ -282,6 +354,11 @@ def __init__( role_instance: Optional["InstanceViewStatusesSummary"] = None, **kwargs ): + """ + :keyword role_instance: Instance view statuses. + :paramtype role_instance: + ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceViewStatusesSummary + """ super(CloudServiceInstanceView, self).__init__(**kwargs) self.role_instance = role_instance self.sdk_version = None @@ -293,10 +370,10 @@ class CloudServiceListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] - :param next_link: - :type next_link: str + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -315,6 +392,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :keyword next_link: + :paramtype next_link: str + """ super(CloudServiceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -323,12 +406,12 @@ def __init__( class CloudServiceNetworkProfile(msrest.serialization.Model): """Network Profile for the cloud service. - :param load_balancer_configurations: The list of load balancer configurations for the cloud + :ivar load_balancer_configurations: The list of load balancer configurations for the cloud service. - :type load_balancer_configurations: + :vartype load_balancer_configurations: list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfiguration] - :param swappable_cloud_service: - :type swappable_cloud_service: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :ivar swappable_cloud_service: + :vartype swappable_cloud_service: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource """ _attribute_map = { @@ -343,6 +426,14 @@ def __init__( swappable_cloud_service: Optional["SubResource"] = None, **kwargs ): + """ + :keyword load_balancer_configurations: The list of load balancer configurations for the cloud + service. + :paramtype load_balancer_configurations: + list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfiguration] + :keyword swappable_cloud_service: + :paramtype swappable_cloud_service: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + """ super(CloudServiceNetworkProfile, self).__init__(**kwargs) self.load_balancer_configurations = load_balancer_configurations self.swappable_cloud_service = swappable_cloud_service @@ -351,8 +442,8 @@ def __init__( 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: + :ivar secrets: Specifies set of certificates that should be installed onto the role instances. + :vartype secrets: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultSecretGroup] """ @@ -366,6 +457,12 @@ def __init__( secrets: Optional[List["CloudServiceVaultSecretGroup"]] = None, **kwargs ): + """ + :keyword secrets: Specifies set of certificates that should be installed onto the role + instances. + :paramtype secrets: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultSecretGroup] + """ super(CloudServiceOsProfile, self).__init__(**kwargs) self.secrets = secrets @@ -375,25 +472,25 @@ class CloudServiceProperties(msrest.serialization.Model): 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 + :ivar 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 + :vartype package_url: str + :ivar configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :vartype configuration: str + :ivar 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 + :vartype configuration_url: str + :ivar 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 upgrade_mode: Update mode for the cloud service. Role instances are allocated to update + :vartype start_cloud_service: bool + :ivar 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:`
    `\ @@ -401,17 +498,17 @@ class CloudServiceProperties(msrest.serialization.Model): 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 + :vartype upgrade_mode: str or ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpgradeMode - :param role_profile: Describes the role profile for the cloud service. - :type role_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfile - :param os_profile: Describes the OS profile for the cloud service. - :type os_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceOsProfile - :param network_profile: Network Profile for the cloud service. - :type network_profile: + :ivar role_profile: Describes the role profile for the cloud service. + :vartype role_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfile + :ivar os_profile: Describes the OS profile for the cloud service. + :vartype os_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceOsProfile + :ivar network_profile: Network Profile for the cloud service. + :vartype network_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceNetworkProfile - :param extension_profile: Describes a cloud service extension profile. - :type extension_profile: + :ivar extension_profile: Describes a cloud service extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProfile :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str @@ -452,6 +549,46 @@ def __init__( extension_profile: Optional["CloudServiceExtensionProfile"] = None, **kwargs ): + """ + :keyword 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. + :paramtype package_url: str + :keyword configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :paramtype configuration: str + :keyword 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. + :paramtype configuration_url: str + :keyword 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. + :paramtype start_cloud_service: bool + :keyword 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". + :paramtype upgrade_mode: str or + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpgradeMode + :keyword role_profile: Describes the role profile for the cloud service. + :paramtype role_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfile + :keyword os_profile: Describes the OS profile for the cloud service. + :paramtype os_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceOsProfile + :keyword network_profile: Network Profile for the cloud service. + :paramtype network_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceNetworkProfile + :keyword extension_profile: Describes a cloud service extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProfile + """ super(CloudServiceProperties, self).__init__(**kwargs) self.package_url = package_url self.configuration = configuration @@ -479,10 +616,10 @@ class CloudServiceRole(msrest.serialization.Model): :vartype type: str :ivar location: Resource location. :vartype location: str - :param sku: Describes the cloud service role sku. - :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku - :param properties: - :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProperties + :ivar sku: Describes the cloud service role sku. + :vartype sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku + :ivar properties: + :vartype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProperties """ _validation = { @@ -508,6 +645,13 @@ def __init__( properties: Optional["CloudServiceRoleProperties"] = None, **kwargs ): + """ + :keyword sku: Describes the cloud service role sku. + :paramtype sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku + :keyword properties: + :paramtype properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProperties + """ super(CloudServiceRole, self).__init__(**kwargs) self.id = None self.name = None @@ -522,10 +666,10 @@ class CloudServiceRoleListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRole] - :param next_link: - :type next_link: str + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRole] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -544,6 +688,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRole] + :keyword next_link: + :paramtype next_link: str + """ super(CloudServiceRoleListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -552,8 +702,8 @@ def __init__( class CloudServiceRoleProfile(msrest.serialization.Model): """Describes the role profile for the cloud service. - :param roles: List of roles for the cloud service. - :type roles: + :ivar roles: List of roles for the cloud service. + :vartype roles: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfileProperties] """ @@ -567,6 +717,11 @@ def __init__( roles: Optional[List["CloudServiceRoleProfileProperties"]] = None, **kwargs ): + """ + :keyword roles: List of roles for the cloud service. + :paramtype roles: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfileProperties] + """ super(CloudServiceRoleProfile, self).__init__(**kwargs) self.roles = roles @@ -574,10 +729,10 @@ def __init__( 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.v2020_10_01_preview.models.CloudServiceRoleSku + :ivar name: Resource name. + :vartype name: str + :ivar sku: Describes the cloud service role sku. + :vartype sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku """ _attribute_map = { @@ -592,6 +747,12 @@ def __init__( sku: Optional["CloudServiceRoleSku"] = None, **kwargs ): + """ + :keyword name: Resource name. + :paramtype name: str + :keyword sku: Describes the cloud service role sku. + :paramtype sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku + """ super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) self.name = name self.sku = sku @@ -618,6 +779,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudServiceRoleProperties, self).__init__(**kwargs) self.unique_id = None @@ -625,15 +788,15 @@ def __init__( 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 + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of role instances in the cloud service. + :vartype capacity: long """ _attribute_map = { @@ -650,6 +813,17 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword 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. + :paramtype name: str + :keyword tier: Specifies the tier of the cloud service. Possible Values are :code:`
    `:code:`
    ` **Standard** :code:`
    `:code:`
    ` **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of role instances in the cloud service. + :paramtype capacity: long + """ super(CloudServiceRoleSku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -659,8 +833,8 @@ def __init__( class CloudServiceUpdate(msrest.serialization.Model): """CloudServiceUpdate. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -673,6 +847,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(CloudServiceUpdate, self).__init__(**kwargs) self.tags = tags @@ -680,10 +858,10 @@ def __init__( class CloudServiceVaultAndSecretReference(msrest.serialization.Model): """CloudServiceVaultAndSecretReference. - :param source_vault: - :type source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource - :param secret_url: - :type secret_url: str + :ivar source_vault: + :vartype source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :ivar secret_url: + :vartype secret_url: str """ _attribute_map = { @@ -698,6 +876,12 @@ def __init__( secret_url: Optional[str] = None, **kwargs ): + """ + :keyword source_vault: + :paramtype source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :keyword secret_url: + :paramtype secret_url: str + """ super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -706,9 +890,9 @@ def __init__( 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 + :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as a secret. - :type certificate_url: str + :vartype certificate_url: str """ _attribute_map = { @@ -721,6 +905,11 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword certificate_url: This is the URL of a certificate that has been uploaded to Key Vault + as a secret. + :paramtype certificate_url: str + """ super(CloudServiceVaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url @@ -728,12 +917,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: + :vartype vault_certificates: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultCertificate] """ @@ -749,6 +938,15 @@ def __init__( vault_certificates: Optional[List["CloudServiceVaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultCertificate] + """ super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -757,10 +955,10 @@ def __init__( 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: + :ivar name: The name of the extension. + :vartype name: str + :ivar properties: Extension Properties. + :vartype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProperties """ @@ -776,6 +974,13 @@ def __init__( properties: Optional["CloudServiceExtensionProperties"] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword properties: Extension Properties. + :paramtype properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProperties + """ super(Extension, self).__init__(**kwargs) self.name = name self.properties = properties @@ -784,10 +989,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -802,6 +1007,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -832,6 +1043,8 @@ def __init__( self, **kwargs ): + """ + """ super(InstanceSku, self).__init__(**kwargs) self.name = None self.tier = None @@ -858,6 +1071,8 @@ def __init__( self, **kwargs ): + """ + """ super(InstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -865,10 +1080,10 @@ def __init__( class LoadBalancerConfiguration(msrest.serialization.Model): """Describes the load balancer configuration. - :param name: Resource Name. - :type name: str - :param properties: - :type properties: + :ivar name: Resource Name. + :vartype name: str + :ivar properties: + :vartype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfigurationProperties """ @@ -884,6 +1099,13 @@ def __init__( properties: Optional["LoadBalancerConfigurationProperties"] = None, **kwargs ): + """ + :keyword name: Resource Name. + :paramtype name: str + :keyword properties: + :paramtype properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfigurationProperties + """ super(LoadBalancerConfiguration, self).__init__(**kwargs) self.name = name self.properties = properties @@ -892,8 +1114,8 @@ def __init__( class LoadBalancerConfigurationProperties(msrest.serialization.Model): """LoadBalancerConfigurationProperties. - :param frontend_ip_configurations: List of IP. - :type frontend_ip_configurations: + :ivar frontend_ip_configurations: List of IP. + :vartype frontend_ip_configurations: list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfiguration] """ @@ -907,6 +1129,11 @@ def __init__( frontend_ip_configurations: Optional[List["LoadBalancerFrontendIPConfiguration"]] = None, **kwargs ): + """ + :keyword frontend_ip_configurations: List of IP. + :paramtype frontend_ip_configurations: + list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfiguration] + """ super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) self.frontend_ip_configurations = frontend_ip_configurations @@ -914,10 +1141,10 @@ def __init__( class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): """LoadBalancerFrontendIPConfiguration. - :param name: - :type name: str - :param properties: Describes a cloud service IP Configuration. - :type properties: + :ivar name: + :vartype name: str + :ivar properties: Describes a cloud service IP Configuration. + :vartype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfigurationProperties """ @@ -933,6 +1160,13 @@ def __init__( properties: Optional["LoadBalancerFrontendIPConfigurationProperties"] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword properties: Describes a cloud service IP Configuration. + :paramtype properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfigurationProperties + """ super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) self.name = name self.properties = properties @@ -941,12 +1175,12 @@ def __init__( class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): """Describes a cloud service IP Configuration. - :param public_ip_address: - :type public_ip_address: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource - :param subnet: - :type subnet: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource - :param private_ip_address: The private IP address referenced by the cloud service. - :type private_ip_address: str + :ivar public_ip_address: + :vartype public_ip_address: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :ivar subnet: + :vartype subnet: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :ivar private_ip_address: The private IP address referenced by the cloud service. + :vartype private_ip_address: str """ _attribute_map = { @@ -963,6 +1197,14 @@ def __init__( private_ip_address: Optional[str] = None, **kwargs ): + """ + :keyword public_ip_address: + :paramtype public_ip_address: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :keyword subnet: + :paramtype subnet: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :keyword private_ip_address: The private IP address referenced by the cloud service. + :paramtype private_ip_address: str + """ super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) self.public_ip_address = public_ip_address self.subnet = subnet @@ -982,8 +1224,8 @@ class ResourceInstanceViewStatus(msrest.serialization.Model): :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.v2020_10_01_preview.models.StatusLevelTypes + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2020_10_01_preview.models.StatusLevelTypes """ _validation = { @@ -1007,6 +1249,10 @@ def __init__( level: Optional[Union[str, "StatusLevelTypes"]] = None, **kwargs ): + """ + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2020_10_01_preview.models.StatusLevelTypes + """ super(ResourceInstanceViewStatus, self).__init__(**kwargs) self.code = None self.display_status = None @@ -1030,10 +1276,10 @@ class RoleInstance(msrest.serialization.Model): :vartype location: str :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] - :param sku: - :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceSku - :param properties: - :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceProperties + :ivar sku: + :vartype sku: ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceSku + :ivar properties: + :vartype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceProperties """ _validation = { @@ -1061,6 +1307,12 @@ def __init__( properties: Optional["RoleInstanceProperties"] = None, **kwargs ): + """ + :keyword sku: + :paramtype sku: ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceSku + :keyword properties: + :paramtype properties: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceProperties + """ super(RoleInstance, self).__init__(**kwargs) self.id = None self.name = None @@ -1076,10 +1328,10 @@ class RoleInstanceListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstance] - :param next_link: - :type next_link: str + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstance] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -1098,6 +1350,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstance] + :keyword next_link: + :paramtype next_link: str + """ super(RoleInstanceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1125,6 +1383,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleInstanceNetworkProfile, self).__init__(**kwargs) self.network_interfaces = None @@ -1132,11 +1392,11 @@ def __init__( class RoleInstanceProperties(msrest.serialization.Model): """RoleInstanceProperties. - :param network_profile: Describes the network profile for the role instance. - :type network_profile: + :ivar network_profile: Describes the network profile for the role instance. + :vartype network_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceNetworkProfile - :param instance_view: The instance view of the role instance. - :type instance_view: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceView + :ivar instance_view: The instance view of the role instance. + :vartype instance_view: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceView """ _attribute_map = { @@ -1151,6 +1411,13 @@ def __init__( instance_view: Optional["RoleInstanceView"] = None, **kwargs ): + """ + :keyword network_profile: Describes the network profile for the role instance. + :paramtype network_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceNetworkProfile + :keyword instance_view: The instance view of the role instance. + :paramtype instance_view: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceView + """ super(RoleInstanceProperties, self).__init__(**kwargs) self.network_profile = network_profile self.instance_view = instance_view @@ -1161,9 +1428,9 @@ class RoleInstances(msrest.serialization.Model): 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 + :ivar 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] + :vartype role_instances: list[str] """ _validation = { @@ -1180,6 +1447,11 @@ def __init__( role_instances: List[str], **kwargs ): + """ + :keyword role_instances: Required. List of cloud service role instance names. Value of '*' will + signify all role instances of the cloud service. + :paramtype role_instances: list[str] + """ super(RoleInstances, self).__init__(**kwargs) self.role_instances = role_instances @@ -1220,6 +1492,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleInstanceView, self).__init__(**kwargs) self.platform_update_domain = None self.platform_fault_domain = None @@ -1252,6 +1526,8 @@ def __init__( self, **kwargs ): + """ + """ super(StatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -1260,8 +1536,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1274,6 +1550,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1303,6 +1583,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDomain, self).__init__(**kwargs) self.id = None self.name = None @@ -1313,10 +1595,10 @@ class UpdateDomainListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain] - :param next_link: - :type next_link: str + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -1335,6 +1617,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain] + :keyword next_link: + :paramtype next_link: str + """ super(UpdateDomainListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py index ff45af6ac727..01a58d85d168 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py @@ -5,25 +5,329 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, IO, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_delete_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_rebuild_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_remote_desktop_file_request( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/x-rdp" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudServiceRoleInstancesOperations(object): """CloudServiceRoleInstancesOperations operations. @@ -49,39 +353,28 @@ def __init__(self, client, config, serializer, deserializer): def _delete_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,14 +387,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a role instance from a cloud service. :param role_instance_name: Name of the role instance. @@ -112,15 +406,17 @@ def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -135,22 +431,14 @@ def begin_delete( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -162,17 +450,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + @distributed_trace def get( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleInstance" + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.RoleInstance": """Gets a role instance from a cloud service. :param role_instance_name: Name of the role instance. @@ -181,7 +470,8 @@ def get( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. + :param expand: The expand expression to apply to the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) @@ -193,30 +483,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,16 +509,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace def get_instance_view( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleInstanceView" + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.RoleInstanceView": """Retrieves information about the run-time state of a role instance in a cloud service. :param role_instance_name: Name of the role instance. @@ -258,28 +539,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_instance_view.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,16 +564,18 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cloud_service_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleInstanceListResult"] + resource_group_name: str, + cloud_service_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> Iterable["_models.RoleInstanceListResult"]: """Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances. @@ -311,11 +584,14 @@ def list( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. + :param expand: The expand expression to apply to the operation. The default value is + "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 RoleInstanceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] + :return: An iterator like instance of either RoleInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] @@ -323,38 +599,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleInstanceListResult', pipeline_response) + deserialized = self._deserialize("RoleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -372,6 +645,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -379,39 +653,28 @@ def get_next(next_link=None): def _restart_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_restart_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -424,14 +687,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. @@ -443,15 +707,17 @@ def begin_restart( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -466,22 +732,14 @@ def begin_restart( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -493,43 +751,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore def _reimage_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._reimage_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_reimage_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -542,14 +790,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles. @@ -561,15 +810,17 @@ def begin_reimage( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -584,22 +835,14 @@ def begin_reimage( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -611,43 +854,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore def _rebuild_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_rebuild_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -660,14 +893,15 @@ def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + @distributed_trace def begin_rebuild( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instance. @@ -680,15 +914,17 @@ def begin_rebuild( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -703,22 +939,14 @@ def begin_rebuild( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -730,16 +958,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + @distributed_trace def get_remote_desktop_file( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> IO + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> IO: """Gets a remote desktop file for a role instance in a cloud service. :param role_instance_name: Name of the role instance. @@ -758,28 +987,18 @@ def get_remote_desktop_file( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/x-rdp" - - # Construct URL - url = self.get_remote_desktop_file.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_remote_desktop_file_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_remote_desktop_file.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) response = pipeline_response.http_response @@ -793,4 +1012,6 @@ def get_remote_desktop_file( return cls(pipeline_response, deserialized, {}) return deserialized + get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py index cf24771e9266..2f73f3303d25 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py @@ -5,23 +5,97 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + role_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}') + path_format_arguments = { + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudServiceRolesOperations(object): """CloudServiceRolesOperations operations. @@ -45,14 +119,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - role_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudServiceRole" + role_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.CloudServiceRole": """Gets a role from a cloud service. :param role_name: Name of the role. @@ -71,28 +145,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_name=role_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,15 +170,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudServiceRoleListResult"] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> Iterable["_models.CloudServiceRoleListResult"]: """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. Do this till nextLink is null to fetch all the roles. @@ -123,8 +189,10 @@ def list( :param cloud_service_name: :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceRoleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] + :return: An iterator like instance of either CloudServiceRoleListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] @@ -132,36 +200,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceRoleListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceRoleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -179,6 +244,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py index 86a531aa5cc5..ebbd6a0c0ea3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py @@ -5,25 +5,531 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_rebuild_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class CloudServicesOperations(object): """CloudServicesOperations operations. @@ -49,46 +555,35 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudService"] - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudService" + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudService"] = None, + **kwargs: Any + ) -> "_models.CloudService": cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudService') + _json = self._serialize.body(parameters, 'CloudService') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,16 +601,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudService"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CloudService"] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudService"] = None, + **kwargs: Any + ) -> LROPoller["_models.CloudService"]: """Create or update a cloud service. Please note some properties can be set only during cloud service creation. @@ -127,15 +624,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CloudService or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CloudService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +649,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,50 +675,40 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudServiceUpdate"] - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudService" + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudServiceUpdate"] = None, + **kwargs: Any + ) -> "_models.CloudService": cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudServiceUpdate') + _json = self._serialize.body(parameters, 'CloudServiceUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,16 +722,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudServiceUpdate"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CloudService"] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudServiceUpdate"] = None, + **kwargs: Any + ) -> LROPoller["_models.CloudService"]: """Update a cloud service. :param resource_group_name: Name of the resource group. @@ -256,15 +744,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CloudService or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CloudService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,27 +769,21 @@ def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -308,41 +795,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -355,13 +832,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a cloud service. :param resource_group_name: Name of the resource group. @@ -370,15 +848,17 @@ def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -392,21 +872,14 @@ def begin_delete( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -418,15 +891,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudService" + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.CloudService": """Display information about a cloud service. :param resource_group_name: Name of the resource group. @@ -443,27 +917,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,15 +941,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudServiceInstanceView" + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.CloudServiceInstanceView": """Gets the status of a cloud service. :param resource_group_name: Name of the resource group. @@ -502,27 +968,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -536,20 +992,24 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudServiceListResult"] + **kwargs: Any + ) -> Iterable["_models.CloudServiceListResult"]: """Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -557,34 +1017,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,17 +1057,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudServiceListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.CloudServiceListResult"]: """Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. @@ -620,8 +1076,10 @@ def list( :param resource_group_name: 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 CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -629,35 +1087,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -675,6 +1129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -682,37 +1137,26 @@ def get_next(next_link=None): def _start_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_start_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,13 +1169,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts the cloud service. :param resource_group_name: Name of the resource group. @@ -740,15 +1185,17 @@ def begin_start( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -762,21 +1209,14 @@ def begin_start( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -788,41 +1228,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore def _power_off_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,13 +1265,14 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Power off the cloud service. Note that resources are still attached and you are getting charged for the resources. @@ -851,15 +1282,17 @@ def begin_power_off( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -873,21 +1306,14 @@ def begin_power_off( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -899,50 +1325,40 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/poweroff'} # type: ignore def _restart_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -955,14 +1371,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more role instances in a cloud service. :param resource_group_name: Name of the resource group. @@ -973,15 +1390,18 @@ def begin_restart( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -993,24 +1413,18 @@ def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1022,50 +1436,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore def _reimage_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1078,14 +1482,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. @@ -1097,15 +1502,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1117,24 +1525,18 @@ def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1146,50 +1548,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore def _rebuild_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_rebuild_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1202,14 +1594,15 @@ def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + @distributed_trace def begin_rebuild( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instances. @@ -1222,15 +1615,18 @@ def begin_rebuild( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1242,24 +1638,18 @@ def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1271,50 +1661,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore def _delete_instances_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1327,14 +1707,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + + @distributed_trace def begin_delete_instances( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes role instances in a cloud service. :param resource_group_name: Name of the resource group. @@ -1345,15 +1726,18 @@ def begin_delete_instances( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1365,24 +1749,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1394,4 +1772,5 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/delete'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py index d9099851d836..b02259241fcf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py @@ -5,25 +5,146 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_walk_update_domain_request_initial( + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "updateDomain": _SERIALIZER.url("update_domain", update_domain, 'int'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_domain_request( + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "updateDomain": _SERIALIZER.url("update_domain", update_domain, 'int'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_update_domains_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudServicesUpdateDomainOperations(object): """CloudServicesUpdateDomainOperations operations. @@ -49,48 +170,37 @@ def __init__(self, client, config, serializer, deserializer): def _walk_update_domain_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - update_domain, # type: int - parameters=None, # type: Optional["_models.UpdateDomain"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional["_models.UpdateDomain"] = None, + **kwargs: Any + ) -> 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 = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._walk_update_domain_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateDomain') + _json = self._serialize.body(parameters, 'UpdateDomain') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_walk_update_domain_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._walk_update_domain_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,15 +213,16 @@ def _walk_update_domain_initial( _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace def begin_walk_update_domain( self, - resource_group_name, # type: str - cloud_service_name, # type: str - update_domain, # type: int - parameters=None, # type: Optional["_models.UpdateDomain"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional["_models.UpdateDomain"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Updates the role instances in the specified update domain. :param resource_group_name: Name of the resource group. @@ -126,15 +237,18 @@ def begin_walk_update_domain( :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -147,25 +261,18 @@ def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - '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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,16 +284,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + @distributed_trace def get_update_domain( self, - resource_group_name, # type: str - cloud_service_name, # type: str - update_domain, # type: int - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateDomain" + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + **kwargs: Any + ) -> "_models.UpdateDomain": """Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page of update domains. Do this till nextLink is null to fetch all the update domains. @@ -209,28 +317,18 @@ def get_update_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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 = build_get_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + template_url=self.get_update_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,15 +342,17 @@ def get_update_domain( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace def list_update_domains( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UpdateDomainListResult"] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> Iterable["_models.UpdateDomainListResult"]: """Gets a list of all update domains in a cloud service. :param resource_group_name: Name of the resource group. @@ -260,8 +360,10 @@ def list_update_domains( :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UpdateDomainListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] + :return: An iterator like instance of either UpdateDomainListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] @@ -269,36 +371,33 @@ def list_update_domains( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - 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_update_domains.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_update_domains.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UpdateDomainListResult', pipeline_response) + deserialized = self._deserialize("UpdateDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -316,6 +415,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py index e1767d9e2356..21ef5dfe9037 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py @@ -6,50 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .operations import DiskRestorePointOperations -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 - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -57,153 +29,155 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_12_01.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_12_01.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_12_01.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_12_01.operations.DiskAccessesOperations :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.v2020_12_01.operations.DiskRestorePointOperations + :vartype disk_restore_point: + azure.mgmt.compute.v2020_12_01.operations.DiskRestorePointOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2020_12_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2020_12_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2020_12_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2020_12_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2020_12_01.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2020_12_01.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2020_12_01.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.v2020_12_01.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2020_12_01.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineImagesOperations :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineImagesEdgeZoneOperations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineImagesEdgeZoneOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2020_12_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2020_12_01.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2020_12_01.operations.ImagesOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2020_12_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineRunCommandsOperations - :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations - :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.v2020_12_01.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2020_12_01.operations.VirtualMachineRunCommandsOperations + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations + operations + :vartype virtual_machine_scale_set_vm_run_commands: + azure.mgmt.compute.v2020_12_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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( - 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 _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(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 _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py index edc40d0b8c91..055c3e81f07f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json index d24dd623edd2..7d0063375aaf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "disks": "DisksOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py index 82841d93f25c..02e28badf664 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py @@ -6,48 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, SnapshotsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .operations import DiskRestorePointOperations -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 - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar disks: DisksOperations operations @@ -55,151 +29,157 @@ class ComputeManagementClient(object): :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2020_12_01.aio.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2020_12_01.aio.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2020_12_01.aio.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2020_12_01.aio.operations.DiskAccessesOperations :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.v2020_12_01.aio.operations.DiskRestorePointOperations + :vartype disk_restore_point: + azure.mgmt.compute.v2020_12_01.aio.operations.DiskRestorePointOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2020_12_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2020_12_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2020_12_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2020_12_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2020_12_01.aio.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2020_12_01.aio.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2020_12_01.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2020_12_01.aio.operations.DedicatedHostsOperations + :vartype dedicated_hosts: + azure.mgmt.compute.v2020_12_01.aio.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2020_12_01.aio.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineImagesOperations :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineImagesEdgeZoneOperations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineImagesEdgeZoneOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2020_12_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2020_12_01.aio.operations.ImagesOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2020_12_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2020_12_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2020_12_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.v2020_12_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2020_12_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.v2020_12_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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(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) + - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( - 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 _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py index f3fb1f881213..97667428c467 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py index 234775a2b48a..7dfdf102b88f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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.v2020_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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.v2020_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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.v2020_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py index df4a4af7d4e5..b58619705ce6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -246,7 +232,8 @@ async def get( :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. + instance view of the dedicated hosts under the dedicated host group. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -258,29 +245,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -294,8 +270,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -307,8 +286,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -316,35 +297,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -362,11 +339,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -375,8 +354,10 @@ def list_by_subscription( 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.v2020_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -384,34 +365,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,6 +405,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py index 2c5229afbee6..15d26e158415 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -438,7 +417,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -450,30 +430,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -487,8 +456,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -503,8 +475,10 @@ def list_by_host_group( :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.v2020_12_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -512,36 +486,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -559,6 +530,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py index bcd2a7c24d77..6821394caa47 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_accesses_operations import build_create_or_update_request_initial, build_delete_a_private_endpoint_connection_request_initial, build_delete_request_initial, build_get_a_private_endpoint_connection_request, build_get_private_link_resources_request, build_get_request, build_list_by_resource_group_request, build_list_private_endpoint_connections_request, build_list_request, build_update_a_private_endpoint_connection_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_12_01.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_12_01.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -423,15 +397,17 @@ async def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -445,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -471,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -484,7 +455,8 @@ def list_by_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 DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -492,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -538,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -551,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -559,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,11 +570,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace_async async def get_private_link_resources( self, resource_group_name: str, @@ -633,27 +601,17 @@ async def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -667,8 +625,10 @@ async def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + async def _update_a_private_endpoint_connection_initial( self, resource_group_name: str, @@ -682,33 +642,23 @@ async def _update_a_private_endpoint_connection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - # 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') + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - 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 @@ -726,8 +676,11 @@ async def _update_a_private_endpoint_connection_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_update_a_private_endpoint_connection( self, resource_group_name: str, @@ -749,18 +702,24 @@ async def begin_update_a_private_endpoint_connection( :type private_endpoint_connection_name: str :param private_endpoint_connection: private endpoint connection object supplied in the body of the Put private endpoint connection operation. - :type private_endpoint_connection: ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -773,28 +732,21 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -806,8 +758,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace_async async def get_a_private_endpoint_connection( self, resource_group_name: str, @@ -835,28 +789,18 @@ async def get_a_private_endpoint_connection( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_a_private_endpoint_connection.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -870,8 +814,10 @@ async def get_a_private_endpoint_connection( return cls(pipeline_response, deserialized, {}) return deserialized + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _delete_a_private_endpoint_connection_initial( self, resource_group_name: str, @@ -884,28 +830,18 @@ async def _delete_a_private_endpoint_connection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -918,6 +854,8 @@ async def _delete_a_private_endpoint_connection_initial( _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete_a_private_endpoint_connection( self, resource_group_name: str, @@ -937,15 +875,17 @@ async def begin_delete_a_private_endpoint_connection( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -960,22 +900,14 @@ async def begin_delete_a_private_endpoint_connection( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -987,8 +919,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_private_endpoint_connections( self, resource_group_name: str, @@ -1004,8 +938,10 @@ def list_private_endpoint_connections( are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -1013,36 +949,33 @@ def list_private_endpoint_connections( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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_private_endpoint_connections.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1060,6 +993,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py index d3297462750a..a3ecc8360581 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_associated_resources_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,20 @@ async def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore async def _update_initial( @@ -186,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,8 +293,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -329,27 +321,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -363,8 +345,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -376,27 +360,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,6 +383,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -425,15 +401,17 @@ async def begin_delete( :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -447,21 +425,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,8 +444,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +458,10 @@ def list_by_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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -494,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -552,8 +525,10 @@ def list( """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -561,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, resource_group_name: str, @@ -627,7 +599,8 @@ def list_associated_resources( :type disk_encryption_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 ResourceUriList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ResourceUriList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] @@ -635,36 +608,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,6 +652,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py index 0c4508028135..8d9ca551895a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_restore_point_operations import build_get_request, build_grant_access_request_initial, build_list_by_restore_point_request, build_revoke_access_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -76,29 +82,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -112,8 +108,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + @distributed_trace def list_by_restore_point( self, resource_group_name: str, @@ -134,8 +133,10 @@ def list_by_restore_point( 80 characters. :type vm_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskRestorePointList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePointList] + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] @@ -143,37 +144,35 @@ def list_by_restore_point( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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_restore_point.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, '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) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskRestorePointList', pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -191,6 +190,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -210,34 +210,24 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -253,8 +243,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -284,15 +277,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_12_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -306,29 +303,21 @@ async def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -340,6 +329,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -355,29 +345,19 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -390,6 +370,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -415,15 +397,17 @@ async def begin_revoke_access( :type disk_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -439,23 +423,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -467,4 +442,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py index f599c28d7eaf..942ec935fcbe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_12_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2020_12_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_12_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py index 9145a0e8a1d1..d4f1a63ef8e5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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.v2020_12_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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.v2020_12_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py index f4c477c353cd..633f84cb82fe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py index 032118d536e4..c3815f34e230 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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.v2020_12_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py index 365f4d235ba1..47c7e71190f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -256,29 +242,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +267,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,8 +279,10 @@ def list_by_subscription( """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.v2020_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -310,34 +290,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,11 +330,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -370,8 +347,10 @@ def list_by_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.v2020_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -379,35 +358,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,6 +400,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py index da22d6bf6771..b27991501e8c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_12_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_12_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_12_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py index f336d4cf6823..5414c487621b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._ssh_public_keys_operations import build_create_request, build_delete_request, build_generate_key_pair_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -49,8 +55,10 @@ def list_by_subscription( 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.v2020_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -58,34 +66,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,11 +106,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -119,8 +124,10 @@ def list_by_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 SshPublicKeysGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -128,35 +135,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,11 +177,13 @@ async def get_next(next_link=None): 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 + @distributed_trace_async async def create( self, resource_group_name: str, @@ -204,32 +209,22 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyResource') - # 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') + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,8 +242,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -274,32 +272,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,8 +301,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -337,25 +328,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,6 +351,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -390,27 +375,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +399,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def generate_key_pair( self, resource_group_name: str, @@ -450,27 +428,17 @@ async def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,4 +452,6 @@ async def generate_key_pair( 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/v2020_12_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_usage_operations.py index 6da47acf5172..0dd754d319cb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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.v2020_12_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py index d64b0f00b681..825b91587d0f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py index 7c50f92503f1..6608629bfbf3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index 06bc7655d8e5..1c7e0ae3d200 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_edge_zone_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -74,31 +79,21 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -112,8 +107,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -156,36 +154,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,8 +184,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -227,28 +215,18 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -262,8 +240,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -286,27 +267,17 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -320,8 +291,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -351,29 +325,19 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -387,4 +351,6 @@ async def list_skus( 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/v2020_12_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_operations.py index 1a37851676b3..e828376d4ee8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py index fc719cf19f02..03daf2849247 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_by_virtual_machine_request, build_get_request, build_list_by_virtual_machine_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,8 +59,10 @@ def list( :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.v2020_12_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,11 +112,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -135,27 +141,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -169,8 +165,10 @@ async def get( 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, @@ -184,33 +182,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -228,8 +216,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,28 +268,21 @@ async def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,6 +294,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -320,33 +310,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +340,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -382,15 +365,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -403,28 +391,21 @@ async def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,6 +417,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -450,28 +432,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,6 +456,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -501,15 +475,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -524,22 +500,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -551,8 +519,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_by_virtual_machine( self, resource_group_name: str, @@ -581,30 +551,19 @@ async def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -618,8 +577,11 @@ async def get_by_virtual_machine( 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 + + @distributed_trace def list_by_virtual_machine( self, resource_group_name: str, @@ -636,8 +598,10 @@ def list_by_virtual_machine( :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.v2020_12_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -645,38 +609,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +655,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 2d8fb3667300..c04b3f34716c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -193,33 +191,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,18 +248,24 @@ async def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,28 +278,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -314,6 +304,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -328,26 +319,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +362,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +387,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,8 +406,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -457,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -494,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -509,8 +482,10 @@ def list( :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.v2020_12_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -518,36 +493,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -565,6 +537,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 1379d44bad55..05324b6b6011 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 662ce9b18b7d..7481c5208308 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -124,18 +121,24 @@ async def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,18 +252,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,29 +283,21 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -322,6 +309,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -337,29 +325,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -372,6 +350,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +372,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,23 +398,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,8 +417,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -477,31 +452,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -515,8 +479,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -545,30 +512,19 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -582,4 +538,6 @@ async def list( 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/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index fc3dbd39e577..6f3eddf67a98 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -102,8 +97,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +125,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -265,15 +254,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,29 +281,21 @@ async def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -321,6 +307,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -336,29 +323,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -371,6 +348,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -391,15 +370,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,23 +396,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -443,8 +415,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -476,31 +450,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -514,8 +477,11 @@ async def get( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -535,8 +501,10 @@ def list( :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.v2020_12_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -544,39 +512,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -594,6 +560,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index b3c48f1cb2b5..b79802a82eda 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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.v2020_12_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -547,28 +514,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -581,6 +539,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -602,15 +562,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -626,22 +588,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -653,8 +607,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -671,7 +627,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -683,30 +640,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -720,8 +666,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -747,28 +696,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -782,8 +721,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -809,8 +751,10 @@ def list( '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.v2020_12_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -818,42 +762,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -871,6 +812,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -889,28 +831,19 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -923,6 +856,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -947,15 +882,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -971,22 +908,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -998,6 +927,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1012,26 +942,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1044,6 +966,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1061,15 +985,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1084,22 +1010,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1111,6 +1029,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1125,26 +1044,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1157,6 +1068,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1174,15 +1087,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1197,22 +1112,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1224,6 +1131,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1238,26 +1146,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1270,6 +1170,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1288,15 +1190,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1311,22 +1215,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1338,8 +1234,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1371,30 +1269,19 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1408,8 +1295,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1422,26 +1311,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1454,6 +1335,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1471,15 +1354,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1494,22 +1379,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1521,8 +1398,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -1548,26 +1427,18 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1580,6 +1451,7 @@ async def simulate_eviction( 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, @@ -1593,33 +1465,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1635,8 +1497,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1657,15 +1522,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1678,28 +1548,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1711,4 +1574,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py index a907625a7b82..42367da618dd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_by_location_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_set_orchestration_service_state_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2020_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -168,8 +163,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -187,15 +185,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +210,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -239,6 +236,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -253,32 +251,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +280,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -311,15 +302,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,27 +327,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -363,6 +353,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -377,27 +368,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,6 +392,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -427,15 +411,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -450,21 +436,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -476,8 +455,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -500,27 +481,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -534,8 +505,10 @@ async def get( 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, @@ -548,33 +521,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,6 +552,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -603,18 +570,22 @@ async def begin_deallocate( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -626,24 +597,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,6 +620,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -670,32 +636,23 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -708,6 +665,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -723,21 +682,25 @@ async def begin_delete_instances( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -750,24 +713,18 @@ async def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -779,8 +736,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -803,27 +762,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -837,8 +786,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -849,8 +801,10 @@ def list( :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.v2020_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -858,35 +812,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -904,11 +854,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -918,8 +870,10 @@ def list_all( 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.v2020_12_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -927,34 +881,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -972,11 +921,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -991,8 +942,10 @@ def list_skus( :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.v2020_12_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -1000,36 +953,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1047,11 +997,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -1065,8 +1017,10 @@ def get_os_upgrade_history( :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.v2020_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1074,36 +1028,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1121,6 +1072,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1139,35 +1091,26 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1180,6 +1123,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1201,18 +1146,22 @@ async def begin_power_off( 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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1225,24 +1174,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1254,6 +1197,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1268,33 +1212,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1307,6 +1243,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1321,18 +1259,22 @@ async def begin_restart( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1344,24 +1286,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1373,6 +1309,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1387,33 +1324,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1426,6 +1355,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1440,18 +1371,22 @@ async def begin_start( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1463,24 +1398,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1492,6 +1421,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1506,33 +1436,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1545,6 +1467,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1560,18 +1484,22 @@ async def begin_redeploy( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1583,24 +1511,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1612,6 +1534,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1626,33 +1549,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1665,6 +1580,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1682,18 +1599,22 @@ async def begin_perform_maintenance( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1705,24 +1626,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1734,6 +1649,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1748,30 +1664,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1784,6 +1692,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1798,18 +1708,22 @@ async def begin_update_instances( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1821,24 +1735,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1850,6 +1758,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1864,33 +1773,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1903,6 +1804,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1919,18 +1822,22 @@ async def begin_reimage( :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.v2020_12_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1942,24 +1849,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1971,6 +1872,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1985,33 +1887,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2024,6 +1918,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -2039,18 +1935,22 @@ async def begin_reimage_all( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2062,24 +1962,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2091,8 +1985,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2120,28 +2016,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2155,8 +2041,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2171,7 +2060,8 @@ async def convert_to_single_placement_group( :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.v2020_12_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2020_12_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 @@ -2182,30 +2072,22 @@ async def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2218,6 +2100,7 @@ async def convert_to_single_placement_group( 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, @@ -2230,30 +2113,22 @@ async def _set_orchestration_service_state_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2266,6 +2141,8 @@ async def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace_async async def begin_set_orchestration_service_state( self, resource_group_name: str, @@ -2283,15 +2160,18 @@ async def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2303,24 +2183,18 @@ async def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2332,4 +2206,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py index c00a218828e4..17401b1825fb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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.v2020_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py index 2f71f99b590a..e262acdf96b6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_assess_patches_request_initial, build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_install_patches_request_initial, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_reapply_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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.v2020_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -315,15 +306,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -367,6 +357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +372,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,8 +401,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,15 +423,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,27 +448,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -491,6 +474,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -505,27 +489,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +513,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -551,20 +528,21 @@ async def begin_delete( :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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,21 +557,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -605,8 +576,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -620,7 +593,8 @@ async def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -632,29 +606,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -668,8 +631,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -692,27 +658,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -726,8 +682,10 @@ async def instance_view( 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, @@ -739,25 +697,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -770,6 +720,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -785,15 +737,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -807,21 +761,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -833,6 +780,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -846,25 +794,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -877,6 +817,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -892,15 +834,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -914,21 +858,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -940,8 +877,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -969,25 +908,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1000,6 +931,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1011,8 +944,10 @@ def list( :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.v2020_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1020,35 +955,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1066,11 +997,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1083,8 +1016,10 @@ def list_all( 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.v2020_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1092,36 +1027,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1139,11 +1069,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1158,8 +1090,10 @@ def list_available_sizes( :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.v2020_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1167,36 +1101,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1214,6 +1145,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1231,27 +1163,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1264,6 +1187,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1284,15 +1209,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,21 +1234,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1333,6 +1253,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1346,27 +1267,17 @@ async def _reapply_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1379,6 +1290,8 @@ async def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace_async async def begin_reapply( self, resource_group_name: str, @@ -1393,15 +1306,17 @@ async def begin_reapply( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1415,21 +1330,14 @@ async def begin_reapply( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1441,6 +1349,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1454,25 +1363,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1485,6 +1386,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1499,15 +1402,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1521,21 +1426,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1547,6 +1445,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1560,25 +1459,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1591,6 +1482,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1605,15 +1498,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1627,21 +1522,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1653,6 +1541,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1666,25 +1555,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1697,6 +1578,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1711,15 +1594,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1733,21 +1618,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1759,6 +1637,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1773,33 +1652,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1812,6 +1683,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1829,15 +1702,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1849,24 +1725,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1878,8 +1748,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1907,29 +1779,18 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1943,8 +1804,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1956,25 +1819,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1987,6 +1842,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -2001,15 +1858,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2023,21 +1882,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2049,8 +1901,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -2073,25 +1927,17 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2104,6 +1950,7 @@ async def simulate_eviction( 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, @@ -2115,27 +1962,17 @@ async def _assess_patches_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2151,8 +1988,11 @@ async def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace_async async def begin_assess_patches( self, resource_group_name: str, @@ -2167,15 +2007,19 @@ async def begin_assess_patches( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2189,24 +2033,17 @@ async def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2218,6 +2055,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2232,32 +2070,22 @@ async def _install_patches_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2273,8 +2101,11 @@ async def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace_async async def begin_install_patches( self, resource_group_name: str, @@ -2289,18 +2120,24 @@ async def begin_install_patches( :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.v2020_12_01.models.VirtualMachineInstallPatchesParameters + :type install_patches_input: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2312,27 +2149,21 @@ async def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2344,6 +2175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2358,32 +2190,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2399,8 +2221,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -2418,15 +2243,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2438,27 +2268,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2470,4 +2294,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_12_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/__init__.py index 81d53cdbd2d1..3e7c193519c7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/__init__.py @@ -6,498 +6,252 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - 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 ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import CreationData - 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 Disk - from ._models_py3 import DiskAccess - from ._models_py3 import DiskAccessList - from ._models_py3 import DiskAccessUpdate - from ._models_py3 import DiskEncryptionSet - from ._models_py3 import DiskEncryptionSetList - from ._models_py3 import DiskEncryptionSetParameters - from ._models_py3 import DiskEncryptionSetUpdate - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskRestorePoint - from ._models_py3 import DiskRestorePointList - from ._models_py3 import DiskSecurityProfile - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import Encryption - from ._models_py3 import EncryptionSetIdentity - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import ExtendedLocation - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDisk - from ._models_py3 import ImageDiskReference - 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 InstanceViewStatus - from ._models_py3 import KeyForDiskEncryptionSet - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - 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 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 OSProfile - 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 PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import PropertyUpdatesInProgress - from ._models_py3 import ProximityPlacementGroup - from ._models_py3 import ProximityPlacementGroupListResult - from ._models_py3 import ProximityPlacementGroupUpdate - from ._models_py3 import ProxyOnlyResource - from ._models_py3 import PurchasePlan - from ._models_py3 import PurchasePlanAutoGenerated - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - from ._models_py3 import ResourceUriList - from ._models_py3 import RetrieveBootDiagnosticsDataResult - 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 ShareInfoElement - from ._models_py3 import Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - 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 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 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 AccessUri # type: ignore - 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 ComputeOperationListResult # type: ignore - from ._models import ComputeOperationValue # type: ignore - from ._models import CreationData # 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 Disk # type: ignore - from ._models import DiskAccess # type: ignore - from ._models import DiskAccessList # type: ignore - from ._models import DiskAccessUpdate # type: ignore - from ._models import DiskEncryptionSet # type: ignore - from ._models import DiskEncryptionSetList # type: ignore - from ._models import DiskEncryptionSetParameters # type: ignore - from ._models import DiskEncryptionSetUpdate # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskRestorePoint # type: ignore - from ._models import DiskRestorePointList # type: ignore - from ._models import DiskSecurityProfile # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionSetIdentity # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import GrantAccessData # 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 ImageDiskReference # 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 InstanceViewStatus # type: ignore - from ._models import KeyForDiskEncryptionSet # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # 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 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 OSProfile # 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 PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import PropertyUpdatesInProgress # type: ignore - from ._models import ProximityPlacementGroup # type: ignore - from ._models import ProximityPlacementGroupListResult # type: ignore - from ._models import ProximityPlacementGroupUpdate # type: ignore - from ._models import ProxyOnlyResource # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import PurchasePlanAutoGenerated # type: ignore - from ._models import RecoveryWalkResponse # type: ignore - from ._models import RequestRateByIntervalInput # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceUriList # type: ignore - from ._models import RetrieveBootDiagnosticsDataResult # 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 ShareInfoElement # type: ignore - from ._models import Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # 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 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 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 ._models_py3 import AccessUri +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 ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import CreationData +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 Disk +from ._models_py3 import DiskAccess +from ._models_py3 import DiskAccessList +from ._models_py3 import DiskAccessUpdate +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetParameters +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskRestorePoint +from ._models_py3 import DiskRestorePointList +from ._models_py3 import DiskSecurityProfile +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import ExtendedLocation +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDisk +from ._models_py3 import ImageDiskReference +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 InstanceViewStatus +from ._models_py3 import KeyForDiskEncryptionSet +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +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 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 OSProfile +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 PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import PropertyUpdatesInProgress +from ._models_py3 import ProximityPlacementGroup +from ._models_py3 import ProximityPlacementGroupListResult +from ._models_py3 import ProximityPlacementGroupUpdate +from ._models_py3 import ProxyOnlyResource +from ._models_py3 import PurchasePlan +from ._models_py3 import PurchasePlanAutoGenerated +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceUriList +from ._models_py3 import RetrieveBootDiagnosticsDataResult +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 ShareInfoElement +from ._models_py3 import Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +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 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 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 + from ._compute_management_client_enums import ( AccessLevel, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py index be153e31f6fa..25eb0fe95cc9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -40,7 +25,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -51,7 +36,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -62,13 +47,13 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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 @@ -81,7 +66,7 @@ class DiffDiskPlacement(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CACHE_DISK = "CacheDisk" RESOURCE_DISK = "ResourceDisk" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -104,7 +89,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the disk. UPLOAD = "Upload" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -117,7 +102,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -131,7 +116,7 @@ class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) FORCE_DETACH = "ForceDetach" -class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources @@ -141,7 +126,7 @@ class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -152,7 +137,7 @@ class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: of the keys is Customer managed and the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class DiskSecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskSecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the SecurityType of the VM. Applicable for OS disks only. """ @@ -160,7 +145,7 @@ class DiskSecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Module (vTPM). TRUSTED_LAUNCH = "TrustedLaunch" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible state of the disk. """ @@ -177,7 +162,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -198,7 +183,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: and dev/test that need storage resiliency against zone failures. STANDARD_SSD_ZRS = "StandardSSD_ZRS" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -212,7 +197,7 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExecutionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Script execution status. """ @@ -224,34 +209,34 @@ class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TIMED_OUT = "TimedOut" CANCELED = "Canceled" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -260,7 +245,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -269,7 +254,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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** - @@ -280,7 +265,7 @@ class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -289,7 +274,7 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAccessPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for accessing the disk via network. """ @@ -300,7 +285,7 @@ class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The disk cannot be exported. DENY_ALL = "DenyAll" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -309,28 +294,28 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class OrchestrationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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)): +class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. """ @@ -338,21 +323,21 @@ class OrchestrationServiceState(with_metaclass(_CaseInsensitiveEnumMeta, str, En RUNNING = "Running" SUSPENDED = "Suspended" -class OrchestrationServiceStateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrchestrationServiceStateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action to be performed. """ RESUME = "Resume" SUSPEND = "Suspend" -class PatchAssessmentState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class PatchInstallationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the patch after the installation operation completed. """ @@ -363,7 +348,7 @@ class PatchInstallationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) NOT_SELECTED = "NotSelected" PENDING = "Pending" -class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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." @@ -375,7 +360,7 @@ class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -384,7 +369,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -392,7 +377,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -400,7 +385,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -409,7 +394,7 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -420,14 +405,14 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -436,7 +421,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. @@ -444,7 +429,7 @@ class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TRUSTED_LAUNCH = "TrustedLaunch" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -452,7 +437,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -463,7 +448,7 @@ class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Standard zone redundant storage. STANDARD_ZRS = "Standard_ZRS" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -471,7 +456,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. @@ -489,7 +474,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PREMIUM_ZRS = "Premium_ZRS" STANDARD_SSD_ZRS = "StandardSSD_ZRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -501,7 +486,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -509,7 +494,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -518,14 +503,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -535,20 +520,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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: @@ -730,20 +715,20 @@ class VirtualMachineSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum STANDARD_NV12 = "Standard_NV12" STANDARD_NV24 = "Standard_NV24" -class VmDiskTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VmDiskTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """VM disk types which are disallowed. """ NONE = "None" UNMANAGED = "Unmanaged" -class VMGuestPatchClassificationLinux(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationLinux(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" OTHER = "Other" -class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationWindows(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" @@ -754,7 +739,7 @@ class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, TOOLS = "Tools" UPDATES = "Updates" -class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the reboot requirements of the patch. """ @@ -763,7 +748,7 @@ class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, E ALWAYS_REQUIRES_REBOOT = "AlwaysRequiresReboot" CAN_REQUEST_REBOOT = "CanRequestReboot" -class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines when it is acceptable to reboot a VM during a software update operation. """ @@ -771,7 +756,7 @@ class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, En NEVER = "Never" ALWAYS = "Always" -class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reboot state of the VM following completion of the operation. """ @@ -782,7 +767,7 @@ class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu FAILED = "Failed" COMPLETED = "Completed" -class WindowsVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models.py deleted file mode 100644 index 3cf2b187d7ca..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models.py +++ /dev/null @@ -1,10608 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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.v2020_12_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_12_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_12_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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. - - 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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2020_12_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Sku of the availability set. - :type sku: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2020_12_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, - **kwargs - ): - 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 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.v2020_12_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.v2020_12_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, - **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.v2020_12_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 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.v2020_12_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 CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the - ImageDiskReference will be the ARM id of the shared galley image version from which to create a - disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are - 512 ad 4096. 4096 is the default. - :type logical_sector_size: int - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'gallery_image_reference': {'key': 'galleryImageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - 'logical_sector_size': {'key': 'logicalSectorSize', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.gallery_image_reference = kwargs.get('gallery_image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', None) - self.logical_sector_size = kwargs.get('logical_sector_size', 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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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, - **kwargs - ): - 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. - - 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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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.v2020_12_01.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, - } - - def __init__( - self, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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.v2020_12_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.v2020_12_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, - **kwargs - ): - 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 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.v2020_12_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. The list of dedicated host groups. - :type value: list[~azure.mgmt.compute.v2020_12_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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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.v2020_12_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.v2020_12_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, - **kwargs - ): - 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 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.v2020_12_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', None) - - -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.v2020_12_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_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, - **kwargs - ): - 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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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 Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the - disk attached. maxShares should be set to a value greater than one for disks to allow attaching - them to multiple VMs. - :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :param extended_location: The extended location where the disk will be created. Extended - location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was - created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: - WindowsServer}. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2020_12_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should - be set to a value greater than one for disks to allow attaching them to multiple VMs. - :vartype share_info: list[~azure.mgmt.compute.v2020_12_01.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :ivar property_updates_in_progress: Properties of the disk for which update is pending. - :vartype property_updates_in_progress: - ~azure.mgmt.compute.v2020_12_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param security_profile: Contains the security related information for the resource. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityProfile - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'managed_by_extended': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'share_info': {'readonly': True}, - 'property_updates_in_progress': {'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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'managed_by_extended': {'key': 'managedByExtended', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'share_info': {'key': 'properties.shareInfo', 'type': '[ShareInfoElement]'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, - 'property_updates_in_progress': {'key': 'properties.propertyUpdatesInProgress', 'type': 'PropertyUpdatesInProgress'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'DiskSecurityProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.managed_by_extended = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.extended_location = kwargs.get('extended_location', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.disk_state = None - self.encryption = kwargs.get('encryption', None) - self.max_shares = kwargs.get('max_shares', None) - self.share_info = None - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - self.bursting_enabled = kwargs.get('bursting_enabled', None) - self.property_updates_in_progress = None - self.supports_hibernation = kwargs.get('supports_hibernation', None) - self.security_profile = kwargs.get('security_profile', None) - - -class DiskAccess(Resource): - """disk access resource. - - 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 private_endpoint_connections: A readonly collection of private endpoint connections - created on the disk. Currently only one endpoint connection is supported. - :vartype private_endpoint_connections: - list[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] - :ivar provisioning_state: The disk access resource provisioning state. - :vartype provisioning_state: str - :ivar time_created: The time when the disk access was created. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'time_created': {'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}'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccess, self).__init__(**kwargs) - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None - - -class DiskAccessList(msrest.serialization.Model): - """The List disk access operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with - this to fetch the next page of disk access resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskAccess]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccessList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskAccessUpdate(msrest.serialization.Model): - """Used for updating a disk access resource. - - :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(DiskAccessUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DiskEncryptionSet(Resource): - """disk encryption set resource. - - 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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of - this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool - :ivar last_key_rotation_timestamp: The time when the active key of this disk encryption set was - updated. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'previous_keys': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'last_key_rotation_timestamp': {'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}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, - 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyForDiskEncryptionSet]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'rotation_to_latest_key_version_enabled': {'key': 'properties.rotationToLatestKeyVersionEnabled', 'type': 'bool'}, - 'last_key_rotation_timestamp': {'key': 'properties.lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSet, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - self.previous_keys = None - self.provisioning_state = None - self.rotation_to_latest_key_version_enabled = kwargs.get('rotation_to_latest_key_version_enabled', None) - self.last_key_rotation_timestamp = None - - -class DiskEncryptionSetList(msrest.serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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.v2020_12_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.v2020_12_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 DiskEncryptionSetUpdate(msrest.serialization.Model): - """disk encryption set update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and - Snapshots. - :type active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of - this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, - 'rotation_to_latest_key_version_enabled': {'key': 'properties.rotationToLatestKeyVersionEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - self.rotation_to_latest_key_version_enabled = kwargs.get('rotation_to_latest_key_version_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.v2020_12_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_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 DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ProxyOnlyResource(msrest.serialization.Model): - """The ProxyOnly Resource model definition. - - 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyOnlyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class DiskRestorePoint(ProxyOnlyResource): - """Properties of disk restore point. - - 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 time_created: The timestamp of restorePoint creation. - :vartype time_created: ~datetime.datetime - :ivar source_resource_id: arm id of source disk. - :vartype source_resource_id: str - :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". - :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was - created. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan - :ivar family_id: id of the backing snapshot's MIS family. - :vartype family_id: str - :ivar source_unique_id: unique incarnation id of the source disk. - :vartype source_unique_id: str - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'time_created': {'readonly': True}, - 'source_resource_id': {'readonly': True}, - 'os_type': {'readonly': True}, - 'family_id': {'readonly': True}, - 'source_unique_id': {'readonly': True}, - 'encryption': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - 'family_id': {'key': 'properties.familyId', 'type': 'str'}, - 'source_unique_id': {'key': 'properties.sourceUniqueId', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskRestorePoint, self).__init__(**kwargs) - self.time_created = None - self.source_resource_id = None - self.os_type = None - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.family_id = None - self.source_unique_id = None - self.encryption = None - self.supports_hibernation = kwargs.get('supports_hibernation', None) - - -class DiskRestorePointList(msrest.serialization.Model): - """The List Disk Restore Points operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk restore points. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePoint] - :param next_link: The uri to fetch the next page of disk restore points. Call ListNext() with - this to fetch the next page of disk restore points. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskRestorePoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskRestorePointList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSecurityProfile(msrest.serialization.Model): - """Contains the security related information for the resource. - - :param security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. - Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityTypes - """ - - _attribute_map = { - 'security_type': {'key': 'securityType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSecurityProfile, self).__init__(**kwargs) - self.security_type = kwargs.get('security_type', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_12_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - 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: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :param purchase_plan: Purchase plan information to be added on the OS disk. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan - :ivar property_updates_in_progress: Properties of the disk for which update is pending. - :vartype property_updates_in_progress: - ~azure.mgmt.compute.v2020_12_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - """ - - _validation = { - 'property_updates_in_progress': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - 'property_updates_in_progress': {'key': 'properties.propertyUpdatesInProgress', 'type': 'PropertyUpdatesInProgress'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.max_shares = kwargs.get('max_shares', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - self.bursting_enabled = kwargs.get('bursting_enabled', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.property_updates_in_progress = None - self.supports_hibernation = kwargs.get('supports_hibernation', None) - - -class Encryption(msrest.serialization.Model): - """Encryption at rest settings for disk or snapshot. - - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", - "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_12_01.models.EncryptionType - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.type = kwargs.get('type', None) - - -class EncryptionSetIdentity(msrest.serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported for new creations. Disk Encryption Sets can be updated with Identity type None during - migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted - resources to lose access to the keys. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSetIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', 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.v2020_12_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 GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_12_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -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.v2020_12_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.v2020_12_01.models.ExtendedLocation - :param source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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 ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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.v2020_12_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.v2020_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_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.v2020_12_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 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.v2020_12_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 KeyForDiskEncryptionSet(msrest.serialization.Model): - """Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Resource id of the KeyVault containing the key or secret. This property is - optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption - Set subscription. - :type source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault - :param key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version - segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. - :type key_url: str - """ - - _validation = { - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyForDiskEncryptionSet, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.key_url = kwargs['key_url'] - - -class KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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 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.v2020_12_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.v2020_12_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. 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. Possible values include: - "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", - "StandardSSD_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", - "Suspend". - :type action: str or ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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 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.v2020_12_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.v2020_12_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2020_12_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 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.v2020_12_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.v2020_12_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 PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(msrest.serialization.Model): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private endpoint connection Id. - :vartype id: str - :ivar name: private endpoint connection name. - :vartype name: str - :ivar type: private endpoint connection type. - :vartype type: str - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: - ~azure.mgmt.compute.v2020_12_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'private_endpoint': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = None - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(msrest.serialization.Model): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private link resource Id. - :vartype id: str - :ivar name: private link resource name. - :vartype name: str - :ivar type: private link resource type. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class PropertyUpdatesInProgress(msrest.serialization.Model): - """Properties of the disk for which update is pending. - - :param target_tier: The target performance tier of the disk if a tier change operation is in - progress. - :type target_tier: str - """ - - _attribute_map = { - 'target_tier': {'key': 'targetTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PropertyUpdatesInProgress, self).__init__(**kwargs) - self.target_tier = kwargs.get('target_tier', 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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2020_12_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.v2020_12_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 name: Required. The plan ID. - :type name: str - :param publisher: Required. The publisher ID. - :type publisher: 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 - :param promotion_code: The Offer Promotion Code. - :type promotion_code: str - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, - } - - _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(PurchasePlan, self).__init__(**kwargs) - self.name = kwargs['name'] - self.publisher = kwargs['publisher'] - self.product = kwargs['product'] - self.promotion_code = kwargs.get('promotion_code', None) - - -class PurchasePlanAutoGenerated(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(PurchasePlanAutoGenerated, 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.v2020_12_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 ResourceUriList(msrest.serialization.Model): - """The List resources which are encrypted with the disk encryption set. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the - disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with - this to fetch the next page of encrypted resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUriList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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 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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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. - - :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.v2020_12_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 - :param 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. Possible values include: - "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2020_12_01.models.SecurityTypes - """ - - _attribute_map = { - 'uefi_settings': {'key': 'uefiSettings', 'type': 'UefiSettings'}, - 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, - 'security_type': {'key': 'securityType', 'type': 'str'}, - } - - 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) - self.security_type = kwargs.get('security_type', None) - - -class ShareInfoElement(msrest.serialization.Model): - """ShareInfoElement. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. - :vartype vm_uri: str - """ - - _validation = { - 'vm_uri': {'readonly': True}, - } - - _attribute_map = { - 'vm_uri': {'key': 'vmUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareInfoElement, self).__init__(**kwargs) - self.vm_uri = 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 Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku - :param extended_location: The extended location where the snapshot will be created. Extended - location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation - :ivar time_created: The time when the snapshot was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the image from which the source disk for - the snapshot was originally created. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", - "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2020_12_01.models.DiskState - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.extended_location = kwargs.get('extended_location', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.supports_hibernation = kwargs.get('supports_hibernation', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_12_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.supports_hibernation = kwargs.get('supports_hibernation', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', 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.v2020_12_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.v2020_12_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 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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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 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.v2020_12_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.v2020_12_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS - Upgrade. - :type automatic_os_upgrade_policy: - ~azure.mgmt.compute.v2020_12_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: An enum describing the unit of usage measurement. Has constant 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.v2020_12_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.v2020_12_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.ExtendedLocation - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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 - """ - - _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'}, - } - - 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) - - -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.v2020_12_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_12_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.v2020_12_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.v2020_12_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_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.v2020_12_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.ExtendedLocation - :param plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlanAutoGenerated - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2020_12_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2020_12_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: - ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the - image. - :type disallowed: ~azure.mgmt.compute.v2020_12_01.models.DisallowedConfiguration - :param features: - :type features: list[~azure.mgmt.compute.v2020_12_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': 'PurchasePlanAutoGenerated'}, - '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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2020_12_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_01.models.InstanceViewStatus] - :param patch_status: [Preview Feature] The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.LastPatchInstallationSummary - :ivar configuration_statuses: The enablement status of the specified patchMode. - :vartype configuration_statuses: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.ExtendedLocation - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_12_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.v2020_12_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_12_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.v2020_12_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.v2020_12_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] - :ivar orchestration_services: The orchestration services information. - :vartype orchestration_services: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace - images. - :type plan: ~azure.mgmt.compute.v2020_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile - """ - - _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'}, - } - - 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) - - -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.v2020_12_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.v2020_12_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: - ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.VirtualMachineScaleSetVMProtectionPolicy - """ - - _validation = { - '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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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: 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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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.v2020_12_01.models.VirtualMachineExtensionInstanceView - """ - - _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'}, - '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.v2020_12_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.v2020_12_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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.v2020_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2020_12_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_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 = { - 'vm_health': {'readonly': True}, - 'assigned_host': {'readonly': True}, - } - - _attribute_map = { - '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(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 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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2020_12_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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.v2020_12_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile - """ - - _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'}, - } - - 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) - - -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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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 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.v2020_12_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.v2020_12_01.models.PatchAssessmentState - """ - - _validation = { - '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 = { - '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(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 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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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.v2020_12_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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.v2020_12_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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': '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.v2020_12_01.models.AdditionalUnattendContent] - :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on - Windows. - :type patch_settings: ~azure.mgmt.compute.v2020_12_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2020_12_01.models.WinRMConfiguration - """ - - _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.v2020_12_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 = { - '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(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 WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2020_12_01.models.WinRMListener] - """ - - _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.v2020_12_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 = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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/v2020_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models_py3.py index 18c91f53d557..a98c208db947 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,11 +44,11 @@ def __init__( 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -59,6 +61,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -66,21 +75,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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.v2020_12_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2020_12_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -99,6 +108,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2020_12_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -109,9 +135,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -124,6 +150,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -131,16 +162,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2020_12_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2020_12_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2020_12_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2020_12_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -161,6 +192,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2020_12_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2020_12_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -172,12 +215,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -194,6 +237,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -203,16 +254,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -227,6 +278,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -237,9 +300,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -256,6 +319,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -263,15 +331,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -286,6 +354,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -304,10 +383,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -332,6 +411,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -353,25 +438,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2020_12_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.v2020_12_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: + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :ivar 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.v2020_12_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ @@ -410,6 +495,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -424,11 +531,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -447,6 +554,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -455,8 +569,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -469,6 +583,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -478,20 +596,20 @@ class AvailabilitySetUpdate(UpdateResource): 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.v2020_12_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.v2020_12_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :ivar 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.v2020_12_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ @@ -521,6 +639,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -587,6 +722,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailablePatchSummary, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -601,7 +738,7 @@ def __init__( 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. + :ivar 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 @@ -613,7 +750,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -626,6 +763,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -633,12 +785,12 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar 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 + :vartype storage_uri: str """ _attribute_map = { @@ -653,6 +805,14 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword 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. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -692,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -719,6 +881,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -764,6 +928,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -780,34 +946,34 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". - :type create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager + :vartype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype gallery_image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are + :vartype upload_size_bytes: long + :ivar logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default. - :type logical_sector_size: int + :vartype logical_sector_size: int """ _validation = { @@ -840,6 +1006,33 @@ def __init__( logical_sector_size: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference + :keyword gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :paramtype gallery_image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + :keyword logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values + are 512 ad 4096. 4096 is the default. + :paramtype logical_sector_size: int + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -859,44 +1052,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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.v2020_12_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :ivar 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.v2020_12_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :ivar 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.v2020_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2020_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :ivar 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.v2020_12_01.models.ManagedDiskParameters - :param to_be_detached: Specifies whether the data disk is in process of detachment from the + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype 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. @@ -905,7 +1098,7 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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 @@ -915,7 +1108,7 @@ class DataDisk(msrest.serialization.Model): 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.v2020_12_01.models.DiskDetachOptionTypes + :vartype detach_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskDetachOptionTypes """ _validation = { @@ -957,6 +1150,57 @@ def __init__( detach_option: Optional[Union[str, "DiskDetachOptionTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + :keyword 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". + :paramtype detach_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskDetachOptionTypes + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -995,6 +1239,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -1012,29 +1258,29 @@ class DedicatedHost(Resource): :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.v2020_12_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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2020_12_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2020_12_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2020_12_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. @@ -1085,6 +1331,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2020_12_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -1100,11 +1368,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -1119,6 +1387,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -1127,9 +1402,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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.v2020_12_01.models.DedicatedHostAllocatableVM] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1142,6 +1418,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1159,27 +1441,27 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2020_12_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.v2020_12_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1215,6 +1497,24 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1226,8 +1526,8 @@ def __init__( 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.v2020_12_01.models.DedicatedHostInstanceViewWithName] + :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostInstanceViewWithName] """ _attribute_map = { @@ -1240,6 +1540,11 @@ def __init__( hosts: Optional[List["DedicatedHostInstanceViewWithName"]] = None, **kwargs ): + """ + :keyword hosts: List of instance view of the dedicated hosts under the dedicated host group. + :paramtype hosts: + list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostInstanceViewWithName] + """ super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) self.hosts = hosts @@ -1249,11 +1554,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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.v2020_12_01.models.DedicatedHostGroup] - :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1272,6 +1577,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1282,25 +1594,25 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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.v2020_12_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.v2020_12_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1327,6 +1639,22 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1343,10 +1671,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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.v2020_12_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2020_12_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ _validation = { @@ -1366,6 +1695,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2020_12_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -1380,10 +1716,11 @@ class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): :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.v2020_12_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2020_12_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] :ivar name: The name of the dedicated host. :vartype name: str """ @@ -1407,6 +1744,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2020_12_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceViewWithName, self).__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) self.name = None @@ -1416,11 +1760,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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.v2020_12_01.models.DedicatedHost] - :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1439,6 +1783,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1449,24 +1800,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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.v2020_12_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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.v2020_12_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2020_12_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. @@ -1505,6 +1856,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2020_12_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -1519,11 +1887,11 @@ def __init__( 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 + :ivar 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.v2020_12_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2020_12_01.models.BootDiagnostics """ _attribute_map = { @@ -1536,6 +1904,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2020_12_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -1543,10 +1918,10 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2020_12_01.models.DiffDiskOptions - :param placement: Specifies the ephemeral disk placement for operating system + :vartype option: str or ~azure.mgmt.compute.v2020_12_01.models.DiffDiskOptions + :ivar 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:`
    ` @@ -1554,7 +1929,7 @@ class DiffDiskSettings(msrest.serialization.Model): 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.v2020_12_01.models.DiffDiskPlacement + :vartype placement: str or ~azure.mgmt.compute.v2020_12_01.models.DiffDiskPlacement """ _attribute_map = { @@ -1569,6 +1944,20 @@ def __init__( placement: Optional[Union[str, "DiffDiskPlacement"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2020_12_01.models.DiffDiskOptions + :keyword 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". + :paramtype placement: str or ~azure.mgmt.compute.v2020_12_01.models.DiffDiskPlacement + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option self.placement = placement @@ -1577,9 +1966,9 @@ def __init__( 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", + :ivar vm_disk_type: VM disk types which are disallowed. Possible values include: "None", "Unmanaged". - :type vm_disk_type: str or ~azure.mgmt.compute.v2020_12_01.models.VmDiskTypes + :vartype vm_disk_type: str or ~azure.mgmt.compute.v2020_12_01.models.VmDiskTypes """ _attribute_map = { @@ -1592,6 +1981,11 @@ def __init__( vm_disk_type: Optional[Union[str, "VmDiskTypes"]] = None, **kwargs ): + """ + :keyword vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :paramtype vm_disk_type: str or ~azure.mgmt.compute.v2020_12_01.models.VmDiskTypes + """ super(DisallowedConfiguration, self).__init__(**kwargs) self.vm_disk_type = vm_disk_type @@ -1609,98 +2003,99 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :param extended_location: The extended location where the disk will be created. Extended + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, or StandardSSD_ZRS. + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] + :ivar extended_location: The extended location where the disk will be created. Extended location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :vartype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long + :vartype disk_m_bps_read_only: long :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "ActiveSAS", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2020_12_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype share_info: list[~azure.mgmt.compute.v2020_12_01.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool + :vartype bursting_enabled: bool :ivar property_updates_in_progress: Properties of the disk for which update is pending. :vartype property_updates_in_progress: ~azure.mgmt.compute.v2020_12_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param security_profile: Contains the security related information for the resource. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityProfile + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar security_profile: Contains the security related information for the resource. + :vartype security_profile: ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityProfile """ _validation = { @@ -1785,6 +2180,79 @@ def __init__( security_profile: Optional["DiskSecurityProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword extended_location: The extended location where the disk will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + WindowsServer}. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + :keyword security_profile: Contains the security related information for the resource. + :paramtype security_profile: ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityProfile + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.managed_by_extended = None @@ -1831,10 +2299,10 @@ class DiskAccess(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar private_endpoint_connections: A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. :vartype private_endpoint_connections: @@ -1873,6 +2341,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccess, self).__init__(location=location, tags=tags, **kwargs) self.private_endpoint_connections = None self.provisioning_state = None @@ -1884,11 +2358,11 @@ class DiskAccessList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with + :ivar value: Required. A list of disk access resources. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] + :ivar next_link: The uri to fetch the next page of disk access resources. Call ListNext() with this to fetch the next page of disk access resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1907,6 +2381,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk access resources. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] + :keyword next_link: The uri to fetch the next page of disk access resources. Call ListNext() + with this to fetch the next page of disk access resources. + :paramtype next_link: str + """ super(DiskAccessList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1915,8 +2396,8 @@ def __init__( class DiskAccessUpdate(msrest.serialization.Model): """Used for updating a disk access resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1929,6 +2410,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccessUpdate, self).__init__(**kwargs) self.tags = tags @@ -1946,27 +2431,27 @@ class DiskEncryptionSet(Resource): :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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet :ivar previous_keys: A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. :vartype previous_keys: list[~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet] :ivar provisioning_state: The disk encryption set provisioning state. :vartype provisioning_state: str - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool + :vartype rotation_to_latest_key_version_enabled: bool :ivar last_key_rotation_timestamp: The time when the active key of this disk encryption set was updated. :vartype last_key_rotation_timestamp: ~datetime.datetime @@ -2008,6 +2493,23 @@ def __init__( rotation_to_latest_key_version_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet + :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating + of this disk encryption set to the latest key version. + :paramtype rotation_to_latest_key_version_enabled: bool + """ super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.encryption_type = encryption_type @@ -2023,11 +2525,11 @@ class DiskEncryptionSetList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2046,6 +2548,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ super(DiskEncryptionSetList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2054,8 +2563,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2068,6 +2577,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -2075,8 +2588,8 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2089,19 +2602,23 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ 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 + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key Vault Secret. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -2118,6 +2635,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -2127,20 +2653,20 @@ def __init__( class DiskEncryptionSetUpdate(msrest.serialization.Model): """disk encryption set update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and + :vartype encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType + :ivar active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. - :type active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + :vartype active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool + :vartype rotation_to_latest_key_version_enabled: bool """ _attribute_map = { @@ -2161,6 +2687,22 @@ def __init__( rotation_to_latest_key_version_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetType + :keyword active_key: Key Vault Key Url to be used for server side encryption of Managed Disks + and Snapshots. + :paramtype active_key: ~azure.mgmt.compute.v2020_12_01.models.KeyForDiskEncryptionSet + :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating + of this disk encryption set to the latest key version. + :paramtype rotation_to_latest_key_version_enabled: bool + """ super(DiskEncryptionSetUpdate, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -2172,13 +2714,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2020_12_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -2195,6 +2738,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -2206,11 +2759,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2229,6 +2782,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2263,6 +2823,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -2286,12 +2848,12 @@ class DiskRestorePoint(ProxyOnlyResource): :vartype source_resource_id: str :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan :ivar family_id: id of the backing snapshot's MIS family. :vartype family_id: str :ivar source_unique_id: unique incarnation id of the source disk. @@ -2299,8 +2861,8 @@ class DiskRestorePoint(ProxyOnlyResource): :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. :vartype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool """ _validation = { @@ -2338,6 +2900,16 @@ def __init__( supports_hibernation: Optional[bool] = None, **kwargs ): + """ + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + """ super(DiskRestorePoint, self).__init__(**kwargs) self.time_created = None self.source_resource_id = None @@ -2355,11 +2927,11 @@ class DiskRestorePointList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk restore points. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePoint] - :param next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + :ivar value: Required. A list of disk restore points. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePoint] + :ivar next_link: The uri to fetch the next page of disk restore points. Call ListNext() with this to fetch the next page of disk restore points. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2378,6 +2950,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk restore points. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePoint] + :keyword next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + this to fetch the next page of disk restore points. + :paramtype next_link: str + """ super(DiskRestorePointList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2386,9 +2965,9 @@ def __init__( class DiskSecurityProfile(msrest.serialization.Model): """Contains the security related information for the resource. - :param security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. + :ivar security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityTypes + :vartype security_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityTypes """ _attribute_map = { @@ -2401,6 +2980,11 @@ def __init__( security_type: Optional[Union[str, "DiskSecurityTypes"]] = None, **kwargs ): + """ + :keyword security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. + Possible values include: "TrustedLaunch". + :paramtype security_type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskSecurityTypes + """ super(DiskSecurityProfile, self).__init__(**kwargs) self.security_type = security_type @@ -2410,9 +2994,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_12_01.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_12_01.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -2432,6 +3016,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_12_01.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -2442,61 +3031,62 @@ class DiskUpdate(msrest.serialization.Model): 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: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, or StandardSSD_ZRS. + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype disk_m_bps_read_only: long + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :param purchase_plan: Purchase plan information to be added on the OS disk. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :vartype bursting_enabled: bool + :ivar purchase_plan: Purchase plan information to be added on the OS disk. + :vartype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan :ivar property_updates_in_progress: Properties of the disk for which update is pending. :vartype property_updates_in_progress: ~azure.mgmt.compute.v2020_12_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool """ _validation = { @@ -2546,6 +3136,62 @@ def __init__( supports_hibernation: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + :keyword purchase_plan: Purchase plan information to be added on the OS disk. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -2570,13 +3216,13 @@ def __init__( class Encryption(msrest.serialization.Model): """Encryption at rest settings for disk or snapshot. - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2020_12_01.models.EncryptionType + :vartype type: str or ~azure.mgmt.compute.v2020_12_01.models.EncryptionType """ _attribute_map = { @@ -2591,6 +3237,15 @@ def __init__( type: Optional[Union[str, "EncryptionType"]] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype type: str or ~azure.mgmt.compute.v2020_12_01.models.EncryptionType + """ super(Encryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id self.type = type @@ -2601,11 +3256,11 @@ class EncryptionSetIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetIdentityType + :vartype type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetIdentityType :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity. @@ -2633,6 +3288,14 @@ def __init__( type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported for new creations. Disk Encryption Sets can be updated with Identity type None + during migration of subscription to a new Azure Active Directory tenant; it will cause the + encrypted resources to lose access to the keys. Possible values include: "SystemAssigned", + "None". + :paramtype type: str or ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetIdentityType + """ super(EncryptionSetIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -2644,18 +3307,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -2676,6 +3339,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -2685,11 +3362,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -2704,6 +3381,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2020_12_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -2712,10 +3397,10 @@ def __init__( 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.v2020_12_01.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -2730,6 +3415,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -2740,10 +3431,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2020_12_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2020_12_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -2763,6 +3454,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2020_12_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -2771,7 +3468,7 @@ def __init__( 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 + :ivar 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 @@ -2817,7 +3514,7 @@ class HardwareProfile(msrest.serialization.Model): "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.v2020_12_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -2830,6 +3527,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -2847,24 +3593,25 @@ class Image(Resource): :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.v2020_12_01.models.ExtendedLocation - :param source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Image. + :vartype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.HyperVGenerationTypes + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationTypes """ _validation = { @@ -2899,6 +3646,25 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Image. + :paramtype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location self.source_virtual_machine = source_virtual_machine @@ -2910,30 +3676,32 @@ def __init__( class ImageDisk(msrest.serialization.Model): """Describes a image disk. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2020_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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.v2020_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -2958,6 +3726,34 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + """ super(ImageDisk, self).__init__(**kwargs) self.snapshot = snapshot self.managed_disk = managed_disk @@ -2973,34 +3769,36 @@ class ImageDataDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2020_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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.v2020_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters - :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype lun: int """ _validation = { @@ -3031,6 +3829,38 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + :keyword 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. + :paramtype lun: int + """ 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 @@ -3040,12 +3870,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -3064,6 +3894,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -3074,11 +3912,11 @@ class ImageListResult(msrest.serialization.Model): 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.v2020_12_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3097,6 +3935,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3107,37 +3952,39 @@ class ImageOSDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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.v2020_12_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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.v2020_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed image disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters - :param os_type: Required. This property allows you to specify the type of the OS that is + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + :ivar 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.v2020_12_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemStateTypes + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemStateTypes """ _validation = { @@ -3171,6 +4018,42 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemStateTypes + """ 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 @@ -3181,21 +4064,21 @@ class ImageReference(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype 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'. @@ -3225,6 +4108,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -3236,19 +4136,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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.v2020_12_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2020_12_01.models.ImageOSDisk + :ivar 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.v2020_12_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2020_12_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -3265,6 +4165,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2020_12_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2020_12_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -3276,20 +4191,21 @@ class ImageUpdate(UpdateResource): 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.v2020_12_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.HyperVGenerationTypes + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationTypes """ _validation = { @@ -3313,6 +4229,21 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -3323,10 +4254,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -3341,6 +4272,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -3349,16 +4286,16 @@ def __init__( 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.v2020_12_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2020_12_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -3379,6 +4316,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2020_12_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -3392,13 +4341,13 @@ class KeyForDiskEncryptionSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Resource id of the KeyVault containing the key or secret. This property is + :ivar source_vault: Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. - :type source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault - :param key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version - segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. - :type key_url: str + :vartype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault + :ivar key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version segment + of the Url is required regardless of rotationToLatestKeyVersionEnabled value. + :vartype key_url: str """ _validation = { @@ -3417,6 +4366,15 @@ def __init__( source_vault: Optional["SourceVault"] = None, **kwargs ): + """ + :keyword source_vault: Resource id of the KeyVault containing the key or secret. This property + is optional and cannot be used if the KeyVault subscription is not the same as the Disk + Encryption Set subscription. + :paramtype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault + :keyword key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version + segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. + :paramtype key_url: str + """ super(KeyForDiskEncryptionSet, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -3427,10 +4385,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -3450,6 +4408,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -3460,10 +4424,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -3483,6 +4447,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -3493,10 +4463,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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.v2020_12_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SubResource """ _validation = { @@ -3516,6 +4486,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -3526,10 +4502,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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.v2020_12_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SubResource """ _validation = { @@ -3549,6 +4525,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -3624,6 +4606,8 @@ def __init__( self, **kwargs ): + """ + """ super(LastPatchInstallationSummary, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -3641,19 +4625,19 @@ def __init__( 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 + :ivar 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.v2020_12_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2020_12_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. - :type patch_settings: ~azure.mgmt.compute.v2020_12_01.models.LinuxPatchSettings + :vartype patch_settings: ~azure.mgmt.compute.v2020_12_01.models.LinuxPatchSettings """ _attribute_map = { @@ -3672,6 +4656,21 @@ def __init__( patch_settings: Optional["LinuxPatchSettings"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2020_12_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :paramtype patch_settings: ~azure.mgmt.compute.v2020_12_01.models.LinuxPatchSettings + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -3682,19 +4681,19 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Linux. - :type classifications_to_include: list[str or + :vartype classifications_to_include: list[str or ~azure.mgmt.compute.v2020_12_01.models.VMGuestPatchClassificationLinux] - :param package_name_masks_to_include: packages to include in the patch operation. Format: + :ivar 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: + :vartype package_name_masks_to_include: list[str] + :ivar 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 + :vartype package_name_masks_to_exclude: list[str] + :ivar maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest Patching in Linux. - :type maintenance_run_id: str + :vartype maintenance_run_id: str """ _attribute_map = { @@ -3713,6 +4712,21 @@ def __init__( maintenance_run_id: Optional[str] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Linux. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2020_12_01.models.VMGuestPatchClassificationLinux] + :keyword package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_include: list[str] + :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_exclude: list[str] + :keyword maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :paramtype maintenance_run_id: str + """ super(LinuxParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.package_name_masks_to_include = package_name_masks_to_include @@ -3723,13 +4737,13 @@ def __init__( 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.v2020_12_01.models.LinuxVMGuestPatchMode + :vartype patch_mode: str or ~azure.mgmt.compute.v2020_12_01.models.LinuxVMGuestPatchMode """ _attribute_map = { @@ -3742,6 +4756,15 @@ def __init__( patch_mode: Optional[Union[str, "LinuxVMGuestPatchMode"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2020_12_01.models.LinuxVMGuestPatchMode + """ super(LinuxPatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode @@ -3751,11 +4774,11 @@ class ListUsagesResult(msrest.serialization.Model): 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.v2020_12_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3774,6 +4797,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3784,23 +4814,23 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -3833,6 +4863,25 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -3865,6 +4914,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -3890,6 +4941,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -3897,23 +4950,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2020_12_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -3938,6 +4991,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2020_12_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -3951,17 +5023,19 @@ def __init__( 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. 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. Possible values include: + :ivar id: Resource Id. + :vartype id: str + :ivar storage_account_type: 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. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -3978,6 +5052,21 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -3986,11 +5075,11 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool + :vartype primary: bool """ _attribute_map = { @@ -4005,6 +5094,13 @@ def __init__( primary: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary @@ -4012,9 +5108,9 @@ def __init__( 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 + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2020_12_01.models.NetworkInterfaceReference] """ @@ -4028,6 +5124,12 @@ def __init__( network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2020_12_01.models.NetworkInterfaceReference] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces @@ -4037,12 +5139,12 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_name: Required. The name of the service. Possible values include: + :ivar service_name: Required. The name of the service. Possible values include: "AutomaticRepairs", "DummyOrchestrationServiceName". - :type service_name: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", + :vartype service_name: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceNames + :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". - :type action: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceStateAction + :vartype action: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceStateAction """ _validation = { @@ -4062,6 +5164,16 @@ def __init__( action: Union[str, "OrchestrationServiceStateAction"], **kwargs ): + """ + :keyword service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :paramtype service_name: str or + ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceNames + :keyword action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :paramtype action: str or + ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceStateAction + """ super(OrchestrationServiceStateInput, self).__init__(**kwargs) self.service_name = service_name self.action = action @@ -4094,6 +5206,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrchestrationServiceSummary, self).__init__(**kwargs) self.service_name = None self.service_state = None @@ -4104,48 +5218,48 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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.v2020_12_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type encryption_settings: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :ivar 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.v2020_12_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :ivar 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.v2020_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2020_12_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2020_12_01.models.DiffDiskSettings + :ivar 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.v2020_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :ivar 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.v2020_12_01.models.ManagedDiskParameters + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.ManagedDiskParameters """ _validation = { @@ -4182,6 +5296,50 @@ def __init__( managed_disk: Optional["ManagedDiskParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2020_12_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.ManagedDiskParameters + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -4201,9 +5359,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes """ _validation = { @@ -4220,6 +5378,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -4227,30 +5390,29 @@ def __init__( 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. + :ivar 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 + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -4265,8 +5427,8 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 @@ -4276,29 +5438,28 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration + :ivar 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.v2020_12_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. - :type secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + :vartype secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar 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 + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -4327,6 +5488,80 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :paramtype secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword 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.**. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -4384,6 +5619,8 @@ def __init__( self, **kwargs ): + """ + """ super(PatchInstallationDetail, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -4396,7 +5633,7 @@ def __init__( 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 @@ -4406,11 +5643,11 @@ class PatchSettings(msrest.serialization.Model): **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.v2020_12_01.models.WindowsVMGuestPatchMode - :param enable_hotpatching: Enables customers to patch their Azure VMs without requiring a + :vartype patch_mode: str or ~azure.mgmt.compute.v2020_12_01.models.WindowsVMGuestPatchMode + :ivar 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 + :vartype enable_hotpatching: bool """ _attribute_map = { @@ -4425,6 +5662,23 @@ def __init__( enable_hotpatching: Optional[bool] = None, **kwargs ): + """ + :keyword 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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2020_12_01.models.WindowsVMGuestPatchMode + :keyword 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'. + :paramtype enable_hotpatching: bool + """ super(PatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode self.enable_hotpatching = enable_hotpatching @@ -4433,15 +5687,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -4460,6 +5714,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4488,6 +5753,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -4505,9 +5772,9 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype type: str :ivar private_endpoint: The resource of private end point. :vartype private_endpoint: ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between DiskAccess and Virtual Network. + :vartype private_link_service_connection_state: ~azure.mgmt.compute.v2020_12_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -4538,6 +5805,12 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between DiskAccess and Virtual Network. + :paramtype private_link_service_connection_state: + ~azure.mgmt.compute.v2020_12_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.id = None self.name = None @@ -4550,11 +5823,11 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -4569,6 +5842,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4589,8 +5869,8 @@ class PrivateLinkResource(msrest.serialization.Model): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -4616,6 +5896,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = None self.name = None @@ -4628,8 +5912,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateLinkResource] """ _attribute_map = { @@ -4642,6 +5926,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -4649,15 +5937,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -4674,6 +5962,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -4683,9 +5982,9 @@ def __init__( class PropertyUpdatesInProgress(msrest.serialization.Model): """Properties of the disk for which update is pending. - :param target_tier: The target performance tier of the disk if a tier change operation is in + :ivar target_tier: The target performance tier of the disk if a tier change operation is in progress. - :type target_tier: str + :vartype target_tier: str """ _attribute_map = { @@ -4698,6 +5997,11 @@ def __init__( target_tier: Optional[str] = None, **kwargs ): + """ + :keyword target_tier: The target performance tier of the disk if a tier change operation is in + progress. + :paramtype target_tier: str + """ super(PropertyUpdatesInProgress, self).__init__(**kwargs) self.target_tier = target_tier @@ -4715,15 +6019,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -4737,8 +6041,8 @@ class ProximityPlacementGroup(Resource): placement group. :vartype availability_sets: list[~azure.mgmt.compute.v2020_12_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus """ _validation = { @@ -4773,6 +6077,20 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -4786,10 +6104,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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.v2020_12_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -4808,6 +6126,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4816,8 +6140,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -4830,6 +6154,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -4838,15 +6166,15 @@ class PurchasePlan(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The plan ID. - :type name: str - :param publisher: Required. The publisher ID. - :type publisher: str - :param product: Required. Specifies the product of the image from the marketplace. This is the + :ivar name: Required. The plan ID. + :vartype name: str + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar 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 - :param promotion_code: The Offer Promotion Code. - :type promotion_code: str + :vartype product: str + :ivar promotion_code: The Offer Promotion Code. + :vartype promotion_code: str """ _validation = { @@ -4871,6 +6199,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The Offer Promotion Code. + :paramtype promotion_code: str + """ super(PurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4883,13 +6222,13 @@ class PurchasePlanAutoGenerated(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -4912,6 +6251,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlanAutoGenerated, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -4944,6 +6292,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -4954,26 +6304,26 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool + :ivar 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.v2020_12_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2020_12_01.models.IntervalInMins """ _validation = { @@ -5009,6 +6359,28 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2020_12_01.models.IntervalInMins + """ 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 @@ -5018,12 +6390,12 @@ class ResourceUriList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + :ivar value: Required. A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + :vartype value: list[str] + :ivar next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -5042,6 +6414,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + disk encryption set. + :paramtype value: list[str] + :keyword next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + this to fetch the next page of encrypted resources. + :paramtype next_link: str + """ super(ResourceUriList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5072,6 +6452,8 @@ def __init__( self, **kwargs ): + """ + """ super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -5107,6 +6489,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -5116,33 +6500,33 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str + :ivar 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 + :vartype enable_cross_zone_upgrade: bool + :ivar prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before any + healthy instances. + :vartype prioritize_unhealthy_instances: bool """ _validation = { @@ -5171,6 +6555,35 @@ def __init__( prioritize_unhealthy_instances: Optional[bool] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + :keyword 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. + :paramtype enable_cross_zone_upgrade: bool + :keyword prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before + any healthy instances. + :paramtype prioritize_unhealthy_instances: bool + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -5214,6 +6627,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -5256,6 +6671,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -5276,10 +6693,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -5321,6 +6738,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -5333,17 +6756,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_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 + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -5372,6 +6795,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -5385,21 +6821,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandParameterDefinition] """ _validation = { @@ -5433,6 +6869,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2020_12_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -5443,13 +6897,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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.v2020_12_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] """ _validation = { @@ -5470,6 +6924,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -5481,10 +6944,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -5504,6 +6967,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -5514,11 +6983,11 @@ class RunCommandListResult(msrest.serialization.Model): 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.v2020_12_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5537,6 +7006,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5547,14 +7023,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -5578,6 +7054,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -5588,8 +7074,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -5602,6 +7088,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -5609,7 +7099,7 @@ def __init__( 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. + :ivar 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 @@ -5623,7 +7113,7 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetScaleInRules] """ @@ -5637,6 +7127,24 @@ def __init__( rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetScaleInRules] + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules @@ -5644,9 +7152,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2020_12_01.models.TerminateNotificationProfile """ @@ -5660,6 +7168,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2020_12_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -5667,20 +7181,20 @@ def __init__( class SecurityProfile(msrest.serialization.Model): """Specifies the Security profile settings for the virtual machine or virtual machine scale set. - :param uefi_settings: Specifies the security settings like secure boot and vTPM used while + :ivar 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.v2020_12_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. + :vartype uefi_settings: ~azure.mgmt.compute.v2020_12_01.models.UefiSettings + :ivar 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 - :param security_type: Specifies the SecurityType of the virtual machine. It is set as + :vartype 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. Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2020_12_01.models.SecurityTypes + :vartype security_type: str or ~azure.mgmt.compute.v2020_12_01.models.SecurityTypes """ _attribute_map = { @@ -5697,6 +7211,22 @@ def __init__( security_type: Optional[Union[str, "SecurityTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype uefi_settings: ~azure.mgmt.compute.v2020_12_01.models.UefiSettings + :keyword 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. + :paramtype encryption_at_host: bool + :keyword 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. Possible values include: + "TrustedLaunch". + :paramtype security_type: str or ~azure.mgmt.compute.v2020_12_01.models.SecurityTypes + """ super(SecurityProfile, self).__init__(**kwargs) self.uefi_settings = uefi_settings self.encryption_at_host = encryption_at_host @@ -5724,6 +7254,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareInfoElement, self).__init__(**kwargs) self.vm_uri = None @@ -5731,14 +7263,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -5755,6 +7287,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5774,37 +7316,37 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku - :param extended_location: The extended location where the snapshot will be created. Extended + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku + :ivar extended_location: The extended location where the snapshot will be created. Extended location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :vartype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation :ivar time_created: The time when the snapshot was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the image from which the source disk for - the snapshot was originally created. - :type purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the image from which the source disk for the + snapshot was originally created. + :vartype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", @@ -5812,25 +7354,26 @@ class Snapshot(Resource): :vartype disk_state: str or ~azure.mgmt.compute.v2020_12_01.models.DiskState :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool """ _validation = { @@ -5893,6 +7436,54 @@ def __init__( supports_hibernation: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku + :keyword extended_location: The extended location where the snapshot will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the image from which the source disk for + the snapshot was originally created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlan + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2020_12_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :paramtype supports_hibernation: bool + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -5920,11 +7511,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -5943,6 +7534,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5953,9 +7551,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2020_12_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2020_12_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -5975,6 +7573,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2020_12_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -5983,33 +7586,34 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool """ _attribute_map = { @@ -6038,6 +7642,37 @@ def __init__( supports_hibernation: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2020_12_01.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2020_12_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :paramtype supports_hibernation: bool + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -6053,8 +7688,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -6067,6 +7702,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -6074,8 +7713,8 @@ def __init__( 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.v2020_12_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2020_12_01.models.SshPublicKey] """ _attribute_map = { @@ -6088,6 +7727,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2020_12_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -6095,15 +7738,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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 + :vartype key_data: str """ _attribute_map = { @@ -6118,6 +7761,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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 + `_. + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -6128,16 +7782,16 @@ class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): 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 + :ivar 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 + :vartype private_key: str + :ivar 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 + :vartype public_key: str + :ivar id: Required. The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - :type id: str + :vartype id: str """ _validation = { @@ -6160,6 +7814,18 @@ def __init__( id: str, **kwargs ): + """ + :keyword 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. + :paramtype private_key: str + :keyword 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. + :paramtype public_key: str + :keyword id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :paramtype id: str + """ super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) self.private_key = private_key self.public_key = public_key @@ -6179,15 +7845,15 @@ class SshPublicKeyResource(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _validation = { @@ -6214,6 +7880,17 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyResource, self).__init__(location=location, tags=tags, **kwargs) self.public_key = public_key @@ -6223,11 +7900,11 @@ class SshPublicKeysGroupListResult(msrest.serialization.Model): 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.v2020_12_01.models.SshPublicKeyResource] - :param next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + :ivar value: Required. The list of SSH public keys. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeyResource] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6246,6 +7923,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of SSH public keys. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeyResource] + :keyword 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. + :paramtype next_link: str + """ super(SshPublicKeysGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6254,13 +7938,13 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _attribute_map = { @@ -6275,6 +7959,15 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyUpdateResource, self).__init__(tags=tags, **kwargs) self.public_key = public_key @@ -6282,21 +7975,21 @@ def __init__( 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 + :ivar 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.v2020_12_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageReference + :ivar 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.v2020_12_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2020_12_01.models.OSDisk + :ivar 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.v2020_12_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2020_12_01.models.DataDisk] """ _attribute_map = { @@ -6313,6 +8006,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2020_12_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2020_12_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -6340,6 +8050,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -6347,11 +8059,11 @@ def __init__( class SubResourceWithColocationStatus(SubResource): """SubResourceWithColocationStatus. - :param id: Resource Id. - :type id: str - :param colocation_status: Describes colocation status of a resource in the Proximity Placement + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus + :vartype colocation_status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus """ _attribute_map = { @@ -6366,6 +8078,13 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword colocation_status: Describes colocation status of a resource in the Proximity + Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus + """ super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) self.colocation_status = colocation_status @@ -6373,13 +8092,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -6394,6 +8113,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -6404,23 +8132,23 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -6453,18 +8181,37 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ 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 + :ivar 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. + :vartype secure_boot_enabled: bool + :ivar 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 + :vartype v_tpm_enabled: bool """ _attribute_map = { @@ -6479,6 +8226,14 @@ def __init__( v_tpm_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Specifies whether vTPM should be enabled on the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype v_tpm_enabled: bool + """ super(UefiSettings, self).__init__(**kwargs) self.secure_boot_enabled = secure_boot_enabled self.v_tpm_enabled = v_tpm_enabled @@ -6514,6 +8269,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -6562,6 +8319,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -6601,6 +8360,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -6610,19 +8371,19 @@ def __init__( 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.v2020_12_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2020_12_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.AutomaticOSUpgradePolicy """ @@ -6640,6 +8401,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2020_12_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2020_12_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -6655,12 +8432,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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.v2020_12_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2020_12_01.models.UsageName """ _validation = { @@ -6687,6 +8464,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2020_12_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -6696,10 +8481,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -6714,6 +8499,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -6744,6 +8535,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6752,21 +8545,21 @@ def __init__( 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 + :ivar 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 + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -6781,6 +8574,23 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `}. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -6789,12 +8599,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2020_12_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2020_12_01.models.VaultCertificate] """ _attribute_map = { @@ -6809,6 +8619,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2020_12_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -6817,8 +8635,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -6831,6 +8649,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -6848,43 +8670,43 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2020_12_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.ExtendedLocation - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :ivar 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.v2020_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :ivar 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 @@ -6897,46 +8719,45 @@ class VirtualMachine(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.v2020_12_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 + :vartype availability_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_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.v2020_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2020_12_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.v2020_12_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. + :vartype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -6946,16 +8767,16 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -6963,7 +8784,7 @@ class VirtualMachine(Resource): 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 + :vartype platform_fault_domain: int """ _validation = { @@ -7040,6 +8861,116 @@ def __init__( platform_fault_domain: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -7072,13 +9003,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -7095,6 +9026,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -7160,6 +9100,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -7176,13 +9118,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -7205,6 +9147,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -7216,8 +9167,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -7249,6 +9200,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -7269,36 +9224,37 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2020_12_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -7343,6 +9299,37 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -7359,12 +9346,12 @@ def __init__( 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.v2020_12_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus """ _attribute_map = { @@ -7381,6 +9368,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -7400,23 +9395,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -7451,6 +9446,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -7462,16 +9476,16 @@ def __init__( 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.v2020_12_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -7492,6 +9506,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -7503,8 +9529,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -7517,6 +9543,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -7524,29 +9554,29 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -7575,6 +9605,31 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -7607,6 +9662,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -7622,15 +9679,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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.v2020_12_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2020_12_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_12_01.models.UserAssignedIdentitiesValue] """ @@ -7653,6 +9710,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2020_12_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2020_12_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -7665,18 +9734,18 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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.v2020_12_01.models.ExtendedLocation + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation """ _validation = { @@ -7702,6 +9771,20 @@ def __init__( extended_location: Optional["ExtendedLocation"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -7714,36 +9797,37 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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.v2020_12_01.models.ExtendedLocation - :param plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlanAutoGenerated - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2020_12_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2020_12_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlanAutoGenerated + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2020_12_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2020_12_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2020_12_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationTypes + :ivar disallowed: Specifies disallowed configuration for the VirtualMachine created from the image. - :type disallowed: ~azure.mgmt.compute.v2020_12_01.models.DisallowedConfiguration - :param features: - :type features: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineImageFeature] + :vartype disallowed: ~azure.mgmt.compute.v2020_12_01.models.DisallowedConfiguration + :ivar features: + :vartype features: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineImageFeature] """ _validation = { @@ -7783,6 +9867,40 @@ def __init__( features: Optional[List["VirtualMachineImageFeature"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2020_12_01.models.PurchasePlanAutoGenerated + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2020_12_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2020_12_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2020_12_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationTypes + :keyword disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :paramtype disallowed: ~azure.mgmt.compute.v2020_12_01.models.DisallowedConfiguration + :keyword features: + :paramtype features: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineImageFeature] + """ 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 @@ -7796,10 +9914,10 @@ def __init__( 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 + :ivar name: The name of the feature. + :vartype name: str + :ivar value: The corresponding value for the feature. + :vartype value: str """ _attribute_map = { @@ -7814,6 +9932,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the feature. + :paramtype name: str + :keyword value: The corresponding value for the feature. + :paramtype value: str + """ super(VirtualMachineImageFeature, self).__init__(**kwargs) self.name = name self.value = value @@ -7824,18 +9948,19 @@ class VirtualMachineInstallPatchesParameters(msrest.serialization.Model): 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 + :ivar 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 + :vartype maximum_duration: str + :ivar 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.v2020_12_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.v2020_12_01.models.WindowsParameters - :param linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + :vartype reboot_setting: str or + ~azure.mgmt.compute.v2020_12_01.models.VMGuestPatchRebootSetting + :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the + API. + :vartype windows_parameters: ~azure.mgmt.compute.v2020_12_01.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the API. - :type linux_parameters: ~azure.mgmt.compute.v2020_12_01.models.LinuxParameters + :vartype linux_parameters: ~azure.mgmt.compute.v2020_12_01.models.LinuxParameters """ _validation = { @@ -7859,6 +9984,21 @@ def __init__( linux_parameters: Optional["LinuxParameters"] = None, **kwargs ): + """ + :keyword 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). + :paramtype maximum_duration: str + :keyword reboot_setting: Required. Defines when it is acceptable to reboot a VM during a + software update operation. Possible values include: "IfRequired", "Never", "Always". + :paramtype reboot_setting: str or + ~azure.mgmt.compute.v2020_12_01.models.VMGuestPatchRebootSetting + :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :paramtype windows_parameters: ~azure.mgmt.compute.v2020_12_01.models.WindowsParameters + :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :paramtype linux_parameters: ~azure.mgmt.compute.v2020_12_01.models.LinuxParameters + """ super(VirtualMachineInstallPatchesParameters, self).__init__(**kwargs) self.maximum_duration = maximum_duration self.reboot_setting = reboot_setting @@ -7943,6 +10083,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineInstallPatchesResult, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -7963,47 +10105,47 @@ class VirtualMachineInstanceView(msrest.serialization.Model): 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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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.v2020_12_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.v2020_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2020_12_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2020_12_01.models.BootDiagnosticsInstanceView + :vartype boot_diagnostics: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.InstanceViewStatus] - :param patch_status: [Preview Feature] The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePatchStatus + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar patch_status: [Preview Feature] The status of virtual machine patch operations. + :vartype patch_status: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePatchStatus """ _validation = { @@ -8049,6 +10191,43 @@ def __init__( patch_status: Optional["VirtualMachinePatchStatus"] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2020_12_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2020_12_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2020_12_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :keyword patch_status: [Preview Feature] The status of virtual machine patch operations. + :paramtype patch_status: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePatchStatus + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -8073,11 +10252,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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.v2020_12_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8096,6 +10275,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8106,12 +10292,12 @@ class VirtualMachinePatchStatus(msrest.serialization.Model): 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 + :ivar available_patch_summary: The available patch summary of the latest assessment operation for the virtual machine. - :type available_patch_summary: ~azure.mgmt.compute.v2020_12_01.models.AvailablePatchSummary - :param last_patch_installation_summary: The installation summary of the latest installation + :vartype available_patch_summary: ~azure.mgmt.compute.v2020_12_01.models.AvailablePatchSummary + :ivar last_patch_installation_summary: The installation summary of the latest installation operation for the virtual machine. - :type last_patch_installation_summary: + :vartype last_patch_installation_summary: ~azure.mgmt.compute.v2020_12_01.models.LastPatchInstallationSummary :ivar configuration_statuses: The enablement status of the specified patchMode. :vartype configuration_statuses: @@ -8135,6 +10321,16 @@ def __init__( last_patch_installation_summary: Optional["LastPatchInstallationSummary"] = None, **kwargs ): + """ + :keyword available_patch_summary: The available patch summary of the latest assessment + operation for the virtual machine. + :paramtype available_patch_summary: + ~azure.mgmt.compute.v2020_12_01.models.AvailablePatchSummary + :keyword last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :paramtype last_patch_installation_summary: + ~azure.mgmt.compute.v2020_12_01.models.LastPatchInstallationSummary + """ super(VirtualMachinePatchStatus, self).__init__(**kwargs) self.available_patch_summary = available_patch_summary self.last_patch_installation_summary = last_patch_installation_summary @@ -8144,9 +10340,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -8159,6 +10355,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -8176,33 +10377,33 @@ class VirtualMachineRunCommand(Resource): :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.v2020_12_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -8254,6 +10455,35 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -8271,23 +10501,23 @@ def __init__( 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", + :ivar execution_state: Script execution status. Possible values include: "Unknown", "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". - :type execution_state: str or ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.InstanceViewStatus] + :vartype execution_state: str or ~azure.mgmt.compute.v2020_12_01.models.ExecutionState + :ivar execution_message: Communicate script configuration errors or execution messages. + :vartype execution_message: str + :ivar exit_code: Exit code returned from script execution. + :vartype exit_code: int + :ivar output: Script output stream. + :vartype output: str + :ivar error: Script error stream. + :vartype error: str + :ivar start_time: Script start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Script end time. + :vartype end_time: ~datetime.datetime + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] """ _attribute_map = { @@ -8314,6 +10544,25 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword execution_state: Script execution status. Possible values include: "Unknown", + "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :paramtype execution_state: str or ~azure.mgmt.compute.v2020_12_01.models.ExecutionState + :keyword execution_message: Communicate script configuration errors or execution messages. + :paramtype execution_message: str + :keyword exit_code: Exit code returned from script execution. + :paramtype exit_code: int + :keyword output: Script output stream. + :paramtype output: str + :keyword error: Script error stream. + :paramtype error: str + :keyword start_time: Script start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Script end time. + :paramtype end_time: ~datetime.datetime + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) self.execution_state = execution_state self.execution_message = execution_message @@ -8328,12 +10577,12 @@ def __init__( 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 + :ivar script: Specifies the script content to be executed on the VM. + :vartype script: str + :ivar script_uri: Specifies the script download location. + :vartype script_uri: str + :ivar command_id: Specifies a commandId of predefined built-in script. + :vartype command_id: str """ _attribute_map = { @@ -8350,6 +10599,14 @@ def __init__( command_id: Optional[str] = None, **kwargs ): + """ + :keyword script: Specifies the script content to be executed on the VM. + :paramtype script: str + :keyword script_uri: Specifies the script download location. + :paramtype script_uri: str + :keyword command_id: Specifies a commandId of predefined built-in script. + :paramtype command_id: str + """ super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) self.script = script self.script_uri = script_uri @@ -8361,10 +10618,10 @@ class VirtualMachineRunCommandsListResult(msrest.serialization.Model): 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.v2020_12_01.models.VirtualMachineRunCommand] - :param next_link: The uri to fetch the next page of run commands. - :type next_link: str + :ivar value: Required. The list of run commands. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] + :ivar next_link: The uri to fetch the next page of run commands. + :vartype next_link: str """ _validation = { @@ -8383,6 +10640,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of run commands. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] + :keyword next_link: The uri to fetch the next page of run commands. + :paramtype next_link: str + """ super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8393,31 +10656,31 @@ class VirtualMachineRunCommandUpdate(UpdateResource): 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.v2020_12_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -8460,6 +10723,33 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2020_12_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -8487,70 +10777,70 @@ class VirtualMachineScaleSet(Resource): :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.v2020_12_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :ivar 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.v2020_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.ExtendedLocation - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine Scale Set. + :vartype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2020_12_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar 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 + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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.v2020_12_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.v2020_12_01.models.SubResource - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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. + :vartype host_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :ivar 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.v2020_12_01.models.ScaleInPolicy - :param orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. + :vartype scale_in_policy: ~azure.mgmt.compute.v2020_12_01.models.ScaleInPolicy + :ivar 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.v2020_12_01.models.OrchestrationMode + :vartype orchestration_mode: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationMode """ _validation = { @@ -8615,6 +10905,70 @@ def __init__( orchestration_mode: Optional[Union[str, "OrchestrationMode"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine Scale Set. + :paramtype extended_location: ~azure.mgmt.compute.v2020_12_01.models.ExtendedLocation + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2020_12_01.models.ScaleInPolicy + :keyword orchestration_mode: Specifies the orchestration mode for the virtual machine scale + set. Possible values include: "Uniform", "Flexible". + :paramtype orchestration_mode: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationMode + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -8643,39 +10997,39 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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.v2020_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetManagedDiskParameters - :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + :ivar 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. + :vartype disk_iops_read_write: long + :ivar 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 + :vartype disk_m_bps_read_write: long """ _validation = { @@ -8709,6 +11063,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword 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. + :paramtype disk_iops_read_write: long + :keyword 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. + :paramtype disk_m_bps_read_write: long + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -8728,37 +11117,37 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -8798,6 +11187,35 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.type = None @@ -8818,11 +11236,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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.v2020_12_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8841,6 +11259,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8849,13 +11274,14 @@ def __init__( 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.v2020_12_01.models.VirtualMachineScaleSetExtension] - :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype extensions_time_budget: str """ _attribute_map = { @@ -8870,6 +11296,16 @@ def __init__( extensions_time_budget: Optional[str] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype extensions_time_budget: str + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions self.extensions_time_budget = extensions_time_budget @@ -8886,33 +11322,33 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -8952,6 +11388,33 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -8978,17 +11441,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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.v2020_12_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: + :vartype type: str or ~azure.mgmt.compute.v2020_12_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -9011,6 +11473,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2020_12_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -9043,6 +11519,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -9059,8 +11537,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] :ivar orchestration_services: The orchestration services information. :vartype orchestration_services: list[~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceSummary] @@ -9085,6 +11563,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -9114,6 +11596,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -9123,39 +11607,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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.v2020_12_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2020_12_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2020_12_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :ivar 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: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :ivar 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. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.SubResource] """ _validation = { @@ -9190,6 +11675,44 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2020_12_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -9205,10 +11728,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -9223,6 +11746,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -9233,11 +11762,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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.v2020_12_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2020_12_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9256,6 +11786,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2020_12_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9266,11 +11804,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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.v2020_12_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9289,6 +11827,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9299,11 +11844,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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.v2020_12_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9322,6 +11867,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9332,11 +11884,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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.v2020_12_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9355,6 +11907,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9363,14 +11922,16 @@ def __init__( 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: + :ivar 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.v2020_12_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -9385,6 +11946,18 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2020_12_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetParameters + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -9395,28 +11968,28 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar 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.v2020_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _validation = { @@ -9449,6 +12022,30 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -9463,8 +12060,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -9477,6 +12074,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -9484,12 +12085,12 @@ def __init__( 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 + :ivar 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.v2020_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -9505,6 +12106,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -9515,43 +12125,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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.v2020_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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.v2020_12_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :ivar 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.v2020_12_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2020_12_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2020_12_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -9587,6 +12197,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2020_12_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2020_12_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2020_12_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -9603,25 +12253,24 @@ def __init__( 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 + :ivar 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 + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -9636,27 +12285,27 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration + :ivar 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.v2020_12_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.v2020_12_01.models.VaultSecretGroup] + :vartype linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. + :vartype secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] """ _attribute_map = { @@ -9681,6 +12330,62 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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 + `_. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :paramtype secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -9696,21 +12401,21 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo 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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2020_12_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_01.models.IPVersion + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2020_12_01.models.IPVersion """ _validation = { @@ -9737,6 +12442,23 @@ def __init__( public_ip_address_version: Optional[Union[str, "IPVersion"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2020_12_01.models.IPVersion + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -9751,10 +12473,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -9771,6 +12493,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -9778,9 +12506,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -9793,19 +12521,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -9820,6 +12553,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -9853,6 +12595,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -9894,6 +12638,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -9904,21 +12650,22 @@ def __init__( 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 + :ivar 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.v2020_12_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageReference + :ivar 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.v2020_12_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetOSDisk + :ivar 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.v2020_12_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -9935,6 +12682,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -9944,45 +12709,45 @@ def __init__( 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.v2020_12_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2020_12_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2020_12_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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.v2020_12_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :ivar 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.v2020_12_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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2020_12_01.models.ScaleInPolicy + :ivar 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.v2020_12_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource """ _attribute_map = { @@ -10019,6 +12784,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2020_12_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2020_12_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2020_12_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2020_12_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -10037,34 +12845,34 @@ def __init__( 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.v2020_12_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.v2020_12_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2020_12_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.SubResource] """ _attribute_map = { @@ -10095,6 +12903,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2020_12_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2020_12_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -10110,27 +12950,27 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar 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.v2020_12_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool """ _attribute_map = { @@ -10159,6 +12999,29 @@ def __init__( enable_ip_forwarding: Optional[bool] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -10173,12 +13036,12 @@ def __init__( 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 + :ivar 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.v2020_12_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ @@ -10194,6 +13057,15 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2020_12_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -10202,23 +13074,23 @@ def __init__( 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.v2020_12_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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.v2020_12_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: + :vartype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -10242,6 +13114,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2020_12_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2020_12_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -10254,14 +13146,14 @@ def __init__( 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.v2020_12_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] """ _attribute_map = { @@ -10280,6 +13172,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2020_12_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2020_12_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2020_12_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -10290,12 +13192,12 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ @@ -10313,6 +13215,15 @@ def __init__( dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -10322,12 +13233,13 @@ def __init__( 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.v2020_12_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -10344,6 +13256,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2020_12_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -10353,28 +13274,30 @@ def __init__( 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.v2020_12_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar security_profile: The virtual machine scale set Security profile. + :vartype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2020_12_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. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar 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.v2020_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -10403,6 +13326,32 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword security_profile: The virtual machine scale set Security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -10428,20 +13377,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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.v2020_12_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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.v2020_12_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -10454,29 +13403,29 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile + :ivar 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.v2020_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: + :vartype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :ivar 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 @@ -10486,10 +13435,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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.v2020_12_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2020_12_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 + :ivar 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: @@ -10499,12 +13448,12 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMProtectionPolicy """ @@ -10572,6 +13521,66 @@ def __init__( protection_policy: Optional["VirtualMachineScaleSetVMProtectionPolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMProtectionPolicy + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -10607,32 +13616,33 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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.v2020_12_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -10672,6 +13682,33 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) self.name = None self.type = None @@ -10690,8 +13727,8 @@ def __init__( 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.v2020_12_01.models.VirtualMachineScaleSetVMExtension] + :ivar value: The list of VMSS VM extensions. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] """ _attribute_map = { @@ -10704,6 +13741,11 @@ def __init__( value: Optional[List["VirtualMachineScaleSetVMExtension"]] = None, **kwargs ): + """ + :keyword value: The list of VMSS VM extensions. + :paramtype value: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] + """ super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -10734,6 +13776,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -10750,28 +13794,28 @@ class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _validation = { @@ -10807,6 +13851,30 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -10823,10 +13891,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -10839,6 +13907,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -10848,8 +13922,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -10866,6 +13940,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -10875,39 +13953,39 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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.v2020_12_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2020_12_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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.v2020_12_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2020_12_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2020_12_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 + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -10945,6 +14023,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2020_12_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2020_12_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2020_12_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2020_12_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -10965,11 +14071,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -10988,6 +14094,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10996,8 +14109,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -11011,6 +14124,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -11018,27 +14136,27 @@ def __init__( 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.v2020_12_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :ivar security_profile: Specifies the Security related profile settings for the virtual machines in the scale set. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -11048,24 +14166,25 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :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. + :vartype license_type: str + :ivar 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.v2020_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype priority: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :ivar 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.v2020_12_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile + :vartype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile """ _attribute_map = { @@ -11098,6 +14217,57 @@ def __init__( scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetNetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :paramtype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionProfile + :keyword 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. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2020_12_01.models.ScheduledEventsProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -11115,13 +14285,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -11136,6 +14306,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -11144,20 +14323,20 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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 + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -11180,6 +14359,22 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -11192,8 +14387,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSize] """ _attribute_map = { @@ -11206,6 +14401,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -11271,6 +14470,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -11309,6 +14510,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -11319,37 +14522,37 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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.v2020_12_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :ivar 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.v2020_12_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :ivar 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 @@ -11362,46 +14565,45 @@ class VirtualMachineUpdate(UpdateResource): 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.v2020_12_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 + :vartype availability_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_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.v2020_12_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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.v2020_12_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.v2020_12_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. + :vartype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :ivar 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.v2020_12_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2020_12_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.v2020_12_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -11411,16 +14613,16 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -11428,7 +14630,7 @@ class VirtualMachineUpdate(UpdateResource): 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 + :vartype platform_fault_domain: int """ _validation = { @@ -11492,6 +14694,112 @@ def __init__( platform_fault_domain: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2020_12_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2020_12_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2020_12_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2020_12_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2020_12_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2020_12_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2020_12_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2020_12_01.models.DiagnosticsProfile + :keyword 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. + :paramtype availability_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2020_12_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2020_12_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2020_12_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -11522,11 +14830,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -11539,6 +14847,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -11546,31 +14861,31 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". + :vartype enable_automatic_updates: bool + :ivar 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 + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2020_12_01.models.AdditionalUnattendContent] - :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on Windows. - :type patch_settings: ~azure.mgmt.compute.v2020_12_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :vartype patch_settings: ~azure.mgmt.compute.v2020_12_01.models.PatchSettings + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2020_12_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2020_12_01.models.WinRMConfiguration """ _attribute_map = { @@ -11593,6 +14908,33 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword 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 + `_. + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2020_12_01.models.AdditionalUnattendContent] + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :paramtype patch_settings: ~azure.mgmt.compute.v2020_12_01.models.PatchSettings + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2020_12_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -11605,20 +14947,20 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Windows. - :type classifications_to_include: list[str or + :vartype classifications_to_include: list[str or ~azure.mgmt.compute.v2020_12_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 + :ivar kb_numbers_to_include: Kbs to include in the patch operation. + :vartype kb_numbers_to_include: list[str] + :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :vartype kb_numbers_to_exclude: list[str] + :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :type exclude_kbs_requiring_reboot: bool - :param max_patch_publish_date: This is used to install patches that were published on or before + :vartype exclude_kbs_requiring_reboot: bool + :ivar max_patch_publish_date: This is used to install patches that were published on or before this given max published date. - :type max_patch_publish_date: ~datetime.datetime + :vartype max_patch_publish_date: ~datetime.datetime """ _attribute_map = { @@ -11639,6 +14981,22 @@ def __init__( max_patch_publish_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Windows. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2020_12_01.models.VMGuestPatchClassificationWindows] + :keyword kb_numbers_to_include: Kbs to include in the patch operation. + :paramtype kb_numbers_to_include: list[str] + :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :paramtype kb_numbers_to_exclude: list[str] + :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :paramtype exclude_kbs_requiring_reboot: bool + :keyword max_patch_publish_date: This is used to install patches that were published on or + before this given max published date. + :paramtype max_patch_publish_date: ~datetime.datetime + """ super(WindowsParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.kb_numbers_to_include = kb_numbers_to_include @@ -11650,8 +15008,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2020_12_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2020_12_01.models.WinRMListener] """ _attribute_map = { @@ -11664,6 +15022,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2020_12_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -11671,18 +15033,18 @@ def __init__( 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 + :ivar 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.v2020_12_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2020_12_01.models.ProtocolTypes + :ivar 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 + :vartype certificate_url: str """ _attribute_map = { @@ -11697,6 +15059,20 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2020_12_01.models.ProtocolTypes + :keyword 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:`
    `}. + :paramtype certificate_url: str + """ super(WinRMListener, self).__init__(**kwargs) self.protocol = protocol self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py index 6b42e4ecf625..9791e753334f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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.v2020_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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.v2020_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py index 724a1a1b7c45..ec8b859913dc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +296,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +359,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +388,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +415,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,14 +438,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -254,7 +454,8 @@ def get( :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. + instance view of the dedicated hosts under the dedicated host group. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -266,29 +467,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,22 +492,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -325,35 +519,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -371,22 +561,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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.v2020_12_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -394,34 +587,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,6 +627,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py index f78dd547f57b..699e08f144a0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2020_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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.v2020_12_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHost" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -449,7 +616,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -461,30 +629,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -498,15 +655,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -515,8 +674,10 @@ def list_by_host_group( :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.v2020_12_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -524,36 +685,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py index bb797be7c8d6..dcd556f6483b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py @@ -5,25 +5,440 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_a_private_endpoint_connection_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_endpoint_connections_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskAccessesOperations(object): """DiskAccessesOperations operations. @@ -49,43 +464,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -103,16 +507,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. @@ -125,15 +531,18 @@ def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2020_12_01.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +554,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +580,37 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -235,16 +628,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. @@ -257,15 +652,18 @@ def begin_update( :type disk_access: ~azure.mgmt.compute.v2020_12_01.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +675,21 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +701,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.DiskAccess": """Gets information about a disk access resource. :param resource_group_name: The name of the resource group. @@ -336,27 +729,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +753,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,13 +791,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk access resource. :param resource_group_name: The name of the resource group. @@ -434,15 +809,17 @@ def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -456,21 +833,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -482,14 +852,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a resource group. :param resource_group_name: The name of the resource group. @@ -504,35 +875,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -550,16 +917,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -572,34 +940,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -617,18 +980,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def get_private_link_resources( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources possible under disk access resource. :param resource_group_name: The name of the resource group. @@ -647,27 +1011,17 @@ def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -681,49 +1035,40 @@ def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + def _update_a_private_endpoint_connection_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - 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 @@ -741,17 +1086,19 @@ def _update_a_private_endpoint_connection_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_update_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. @@ -765,18 +1112,24 @@ def begin_update_a_private_endpoint_connection( :type private_endpoint_connection_name: str :param private_endpoint_connection: private endpoint connection object supplied in the body of the Put private endpoint connection operation. - :type private_endpoint_connection: ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -789,28 +1142,21 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -822,16 +1168,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def get_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets information about a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. @@ -852,28 +1199,18 @@ def get_a_private_endpoint_connection( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_a_private_endpoint_connection.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -887,43 +1224,34 @@ def get_a_private_endpoint_connection( return cls(pipeline_response, deserialized, {}) return deserialized + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_a_private_endpoint_connection_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -936,14 +1264,15 @@ def _delete_a_private_endpoint_connection_initial( _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. @@ -956,15 +1285,17 @@ def begin_delete_a_private_endpoint_connection( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -979,22 +1310,14 @@ def begin_delete_a_private_endpoint_connection( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1006,15 +1329,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_private_endpoint_connections( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List information about private endpoint connections under a disk access resource. :param resource_group_name: The name of the resource group. @@ -1024,8 +1348,10 @@ def list_private_endpoint_connections( are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -1033,36 +1359,33 @@ def list_private_endpoint_connections( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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_private_endpoint_connections.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1080,6 +1403,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py index ccf6edc9bd95..d164eead1041 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py @@ -5,25 +5,285 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_associated_resources_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskEncryptionSetsOperations(object): """DiskEncryptionSetsOperations operations. @@ -49,43 +309,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -103,16 +352,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. @@ -126,15 +377,19 @@ def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,27 +401,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,47 +427,37 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -236,16 +475,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. @@ -259,15 +500,19 @@ def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +524,21 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,15 +550,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. @@ -338,27 +578,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,41 +602,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,13 +640,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. @@ -436,15 +658,17 @@ def begin_delete( :type disk_encryption_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -458,21 +682,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -484,21 +701,24 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption 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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -506,35 +726,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,21 +768,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -574,34 +793,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -619,18 +833,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceUriList"] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceUriList"]: """Lists all resources that are encrypted with this disk encryption set. :param resource_group_name: The name of the resource group. @@ -649,36 +864,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -696,6 +908,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py index b6c33ebe2c12..80fc175aba3b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py @@ -5,25 +5,191 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_restore_point_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskRestorePointOperations(object): """DiskRestorePointOperations operations. @@ -47,15 +213,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskRestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> "_models.DiskRestorePoint": """Get disk restorePoint resource. :param resource_group_name: The name of the resource group. @@ -81,29 +247,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,16 +273,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + @distributed_trace def list_by_restore_point( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskRestorePointList"] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskRestorePointList"]: """Lists diskRestorePoints under a vmRestorePoint. :param resource_group_name: The name of the resource group. @@ -140,8 +298,10 @@ def list_by_restore_point( 80 characters. :type vm_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskRestorePointList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePointList] + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] @@ -149,37 +309,35 @@ def list_by_restore_point( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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_restore_point.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, '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) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskRestorePointList', pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -197,6 +355,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -204,47 +363,36 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -260,18 +408,20 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a diskRestorePoint. :param resource_group_name: The name of the resource group. @@ -292,15 +442,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_12_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -314,29 +467,21 @@ def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,45 +493,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -399,15 +534,16 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a diskRestorePoint. :param resource_group_name: The name of the resource group. @@ -425,15 +561,17 @@ def begin_revoke_access( :type disk_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -449,23 +587,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -477,4 +606,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py index b754eb397d1b..ff6b412d4813 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2020_12_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2020_12_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_12_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py index 3a182a33f216..f12803c8400e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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.v2020_12_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py index 24e4cd7c52de..1e07ed584d4a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py index 165cdda7c2a1..48dda8378dbf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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.v2020_12_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py index 2bb98397b820..e73354414a56 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = _SERIALIZER.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +294,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +327,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +357,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +386,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +413,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,14 +436,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -264,29 +464,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,18 +489,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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.v2020_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -319,34 +512,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,24 +552,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -389,35 +580,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +622,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py index e53d47975b28..ddcb0be905f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2020_12_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2020_12_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2020_12_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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 = "2020-12-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py index e23f03042876..101e71ae7c32 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py @@ -5,23 +5,277 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_key_pair_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SshPublicKeysOperations(object): """SshPublicKeysOperations operations. @@ -45,17 +299,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + **kwargs: Any + ) -> 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.v2020_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -63,34 +319,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,25 +359,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -134,35 +388,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,19 +430,20 @@ def get_next(next_link=None): 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 + @distributed_trace def create( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -211,32 +462,22 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyResource') + + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,16 +495,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyUpdateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyUpdateResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -282,32 +525,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -321,15 +554,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> None: """Delete an SSH public key. :param resource_group_name: The name of the resource group. @@ -346,25 +581,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,13 +604,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Retrieves information about an SSH public key. :param resource_group_name: The name of the resource group. @@ -400,27 +628,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,15 +652,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def generate_key_pair( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyGenerateKeyPairResult" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_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. @@ -461,27 +681,17 @@ def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,4 +705,6 @@ def generate_key_pair( 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/v2020_12_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_usage_operations.py index abcbb91d6f75..9d1ea4b227ee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py index aa25d95a3867..ec62a22036ca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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/v2020_12_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extensions_operations.py index 5a70a8d90b12..5314aeee6636 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py index 964b8332c9f2..4c8d8aea07ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -5,22 +5,229 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + edge_zone: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + edge_zone: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesEdgeZoneOperations(object): """VirtualMachineImagesEdgeZoneOperations operations. @@ -44,17 +251,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image in an edge zone. :param location: The name of a supported Azure region. @@ -79,31 +286,21 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + + request = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -117,21 +314,23 @@ def get( 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 + + @distributed_trace 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"] + 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: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. @@ -162,36 +361,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,16 +391,18 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - edge_zone, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image offers for the specified location, edge zone and publisher. @@ -234,28 +422,18 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -269,15 +447,17 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - edge_zone, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + **kwargs: Any + ) -> 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. @@ -294,27 +474,17 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -328,17 +498,19 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace 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"] + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. @@ -360,29 +532,19 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,4 +558,6 @@ def list_skus( 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/v2020_12_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py index 3c37926b479d..a5dc8e5da228 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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/v2020_12_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_run_commands_operations.py index 76a35f9f2d98..43479fc51e08 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_run_commands_operations.py @@ -5,25 +5,305 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -47,19 +327,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -67,35 +349,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,18 +391,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -141,27 +420,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,49 +444,40 @@ def get( 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -235,17 +495,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the run command. :param resource_group_name: The name of the resource group. @@ -259,15 +521,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +547,21 @@ def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,49 +573,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -369,17 +619,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the run command. :param resource_group_name: The name of the resource group. @@ -392,15 +644,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -413,28 +670,21 @@ def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,43 +696,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,14 +735,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - run_command_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the run command. :param resource_group_name: The name of the resource group. @@ -513,15 +754,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -536,22 +779,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -563,17 +798,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the run command. :param resource_group_name: The name of the resource group. @@ -594,30 +830,19 @@ def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -631,16 +856,18 @@ def get_by_virtual_machine( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineRunCommandsListResult"]: """The operation to get all run commands of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -650,8 +877,10 @@ def list_by_virtual_machine( :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.v2020_12_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -659,38 +888,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -708,6 +934,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py index 52f6c6877435..6449d4c2d540 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +320,24 @@ def begin_create_or_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Create VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +350,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +376,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to update an extension. :param resource_group_name: The name of the resource group. @@ -265,18 +449,24 @@ def begin_update( :type vmss_extension_name: str :param extension_parameters: Parameters supplied to the Update VM scale set Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -289,28 +479,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -322,41 +505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +544,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -387,15 +563,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +588,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,17 +607,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -468,30 +639,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +665,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -521,8 +683,10 @@ def list( :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.v2020_12_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -530,36 +694,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -577,6 +738,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 5d56373f253b..c7da3ed00a2c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index ab87f50575e3..09fe42a664db 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,24 +5,246 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMExtensionsOperations(object): """VirtualMachineScaleSetVMExtensionsOperations operations. @@ -48,47 +270,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,18 +317,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -130,18 +343,24 @@ def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +374,21 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +400,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +448,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -271,18 +474,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +505,21 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -330,45 +531,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,15 +572,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -402,15 +594,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,23 +620,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,18 +639,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMExtension": """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -488,31 +674,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,17 +701,19 @@ def get( 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 + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_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. @@ -557,30 +734,19 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,4 +760,6 @@ def list( 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/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 0484f374e2b7..f3111ad18c28 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,25 +5,247 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMRunCommandsOperations(object): """VirtualMachineScaleSetVMRunCommandsOperations operations. @@ -49,47 +271,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -107,18 +318,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -133,15 +346,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +373,21 @@ def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +399,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +447,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -273,15 +475,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,29 +502,21 @@ def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -329,45 +528,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,15 +569,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -401,15 +591,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +617,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -453,18 +636,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -487,31 +671,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -525,17 +698,19 @@ def get( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -547,8 +722,10 @@ def list( :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.v2020_12_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -556,39 +733,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +781,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py index dc1f982713c3..6e65cf2f4330 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,615 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +639,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +682,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +701,22 @@ def begin_reimage( :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.v2020_12_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +729,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +752,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +791,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +811,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +836,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +855,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +894,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +915,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +940,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +959,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +1009,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +1035,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +1061,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,44 +1087,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,15 +1128,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -616,15 +1151,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -640,22 +1177,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -667,17 +1196,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetVM" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -686,7 +1216,8 @@ def get( :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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -698,30 +1229,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -735,16 +1255,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -763,28 +1285,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -798,18 +1310,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -826,8 +1340,10 @@ def list( '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.v2020_12_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -835,42 +1351,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -888,6 +1401,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -895,40 +1409,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -941,15 +1445,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -966,15 +1471,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -990,22 +1497,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1017,41 +1516,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1064,14 +1555,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1082,15 +1574,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1105,22 +1599,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1132,41 +1618,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1179,14 +1657,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1197,15 +1676,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1220,22 +1701,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1247,41 +1720,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1294,14 +1759,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1313,15 +1779,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1336,22 +1804,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1363,17 +1823,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_models.RetrieveBootDiagnosticsDataResult": """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. @@ -1397,30 +1858,19 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1434,41 +1884,34 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1481,14 +1924,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1499,15 +1943,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1522,22 +1968,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1549,16 +1987,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -1577,26 +2016,18 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1609,47 +2040,37 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1665,17 +2086,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1688,15 +2111,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2020_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1709,28 +2136,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1742,4 +2162,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py index 369246c77516..aa79cac9be7c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,934 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_set_orchestration_service_state_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -47,19 +956,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + location: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -67,35 +978,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +1020,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1028,32 @@ def get_next(next_link=None): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -174,16 +1071,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -194,15 +1093,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,27 +1118,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -246,47 +1144,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -300,16 +1188,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -320,15 +1210,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -340,27 +1235,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,42 +1261,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -420,14 +1300,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -438,15 +1319,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -461,21 +1344,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -487,15 +1363,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -512,27 +1389,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -546,48 +1413,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -600,14 +1460,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -617,18 +1478,22 @@ def begin_deallocate( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -640,24 +1505,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,48 +1528,39 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = "2020-12-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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -723,15 +1573,16 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -739,21 +1590,25 @@ def begin_delete_instances( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -766,24 +1621,18 @@ def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -795,15 +1644,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -820,27 +1670,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -854,21 +1694,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -876,35 +1720,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -922,23 +1762,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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.v2020_12_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -946,34 +1789,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -991,18 +1829,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -1011,8 +1850,10 @@ def list_skus( :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.v2020_12_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -1020,36 +1861,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1067,18 +1905,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1086,8 +1925,10 @@ def get_os_upgrade_history( :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.v2020_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1095,36 +1936,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1142,6 +1980,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1149,47 +1988,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1202,15 +2031,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1224,18 +2054,22 @@ def begin_power_off( 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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1248,24 +2082,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1277,48 +2105,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1331,14 +2151,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1346,18 +2167,22 @@ def begin_restart( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1369,24 +2194,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1398,48 +2217,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1452,14 +2263,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1467,18 +2279,22 @@ def begin_start( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1490,24 +2306,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1519,48 +2329,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1573,14 +2375,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1589,18 +2392,22 @@ def begin_redeploy( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1612,24 +2419,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1641,48 +2442,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1695,14 +2488,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1713,18 +2507,22 @@ def begin_perform_maintenance( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,24 +2534,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1765,45 +2557,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1816,14 +2600,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1831,18 +2616,22 @@ def begin_update_instances( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1854,24 +2643,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1883,48 +2666,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1937,14 +2712,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1954,18 +2730,22 @@ def begin_reimage( :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.v2020_12_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1977,24 +2757,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2006,48 +2780,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2060,14 +2826,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -2076,18 +2843,22 @@ def begin_reimage_all( :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2099,24 +2870,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2128,16 +2893,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2158,28 +2924,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2193,16 +2949,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2210,7 +2968,8 @@ def convert_to_single_placement_group( :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.v2020_12_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2020_12_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 @@ -2221,30 +2980,22 @@ def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2257,43 +3008,35 @@ def convert_to_single_placement_group( 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2306,14 +3049,15 @@ def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. @@ -2324,15 +3068,18 @@ def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2344,24 +3091,18 @@ def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2373,4 +3114,5 @@ def get_long_running_output(pipeline_response): ) 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/v2020_12_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_sizes_operations.py index 952eefae46ea..65063ff4f319 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py index ad5b90382464..3c8021d48738 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py @@ -5,25 +5,907 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = "instanceView", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_assess_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +929,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +951,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +993,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1001,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +1042,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +1065,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +1090,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +1116,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +1164,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. @@ -324,15 +1187,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2020_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -344,27 +1211,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,47 +1237,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -430,16 +1281,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -450,15 +1303,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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.v2020_12_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -470,27 +1327,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -502,42 +1353,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,34 +1392,36 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -592,21 +1436,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -618,23 +1455,25 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - vm_name, # type: str - expand="instanceView", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = "instanceView", + **kwargs: Any + ) -> "_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. + :param expand: The expand expression to apply on the operation. The default value is + "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -646,29 +1485,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -682,15 +1510,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -707,27 +1537,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -741,39 +1561,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -786,13 +1599,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -802,15 +1616,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -824,21 +1640,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -850,39 +1659,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -895,13 +1696,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -911,15 +1713,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -933,21 +1737,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -959,15 +1756,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 @@ -989,25 +1787,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,20 +1810,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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.v2020_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1041,35 +1834,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1087,17 +1876,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - status_only=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + status_only: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -1105,8 +1895,10 @@ def list_all( 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.v2020_12_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1114,36 +1906,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1161,18 +1948,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1181,8 +1969,10 @@ def list_available_sizes( :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.v2020_12_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1190,36 +1980,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1237,6 +2024,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1244,38 +2032,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1288,14 +2066,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1309,15 +2088,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1332,21 +2113,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1358,41 +2132,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1405,13 +2169,14 @@ def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace def begin_reapply( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to reapply a virtual machine's state. :param resource_group_name: The name of the resource group. @@ -1420,15 +2185,17 @@ def begin_reapply( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1442,21 +2209,14 @@ def begin_reapply( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1468,39 +2228,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1513,13 +2265,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1528,15 +2281,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1550,21 +2305,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1576,39 +2324,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1621,13 +2361,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1636,15 +2377,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1658,21 +2401,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1684,39 +2420,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1729,13 +2457,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1744,15 +2473,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1766,21 +2497,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1792,48 +2516,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1846,14 +2562,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1864,15 +2581,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1884,24 +2604,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1913,16 +2627,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_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. @@ -1943,29 +2658,18 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1979,39 +2683,32 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2024,13 +2721,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -2039,15 +2737,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2061,21 +2761,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2087,15 +2780,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """The operation to simulate the eviction of spot virtual machine. :param resource_group_name: The name of the resource group. @@ -2112,25 +2806,17 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2143,39 +2829,29 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = "2020-12-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2191,15 +2867,17 @@ def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace def begin_assess_patches( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineAssessPatchesResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineAssessPatchesResult"]: """Assess patches on the VM. :param resource_group_name: The name of the resource group. @@ -2208,15 +2886,19 @@ def begin_assess_patches( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2230,24 +2912,17 @@ def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2259,47 +2934,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2315,16 +2980,18 @@ def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineInstallPatchesResult"]: """Installs patches on the VM. :param resource_group_name: The name of the resource group. @@ -2332,18 +2999,24 @@ def begin_install_patches( :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.v2020_12_01.models.VirtualMachineInstallPatchesParameters + :type install_patches_input: + ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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.v2020_12_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2355,27 +3028,21 @@ def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2387,47 +3054,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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 = "2020-12-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2443,16 +3100,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2463,15 +3122,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2020_12_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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.v2020_12_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2483,27 +3146,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2515,4 +3172,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 15a8bde95a49..dfbfc3a706df 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 @@ -6,214 +6,187 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CloudServiceOperatingSystemsOperations, CloudServiceRoleInstancesOperations, CloudServiceRolesOperations, CloudServicesOperations, CloudServicesUpdateDomainOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, RestorePointCollectionsOperations, RestorePointsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -from .operations import CloudServiceRoleInstancesOperations -from .operations import CloudServiceRolesOperations -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 RestorePointCollectionsOperations -from .operations import RestorePointsOperations -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 - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations - :vartype cloud_service_role_instances: azure.mgmt.compute.v2021_03_01.operations.CloudServiceRoleInstancesOperations + :vartype cloud_service_role_instances: + azure.mgmt.compute.v2021_03_01.operations.CloudServiceRoleInstancesOperations :ivar cloud_service_roles: CloudServiceRolesOperations operations - :vartype cloud_service_roles: azure.mgmt.compute.v2021_03_01.operations.CloudServiceRolesOperations + :vartype cloud_service_roles: + azure.mgmt.compute.v2021_03_01.operations.CloudServiceRolesOperations :ivar cloud_services: CloudServicesOperations operations :vartype cloud_services: azure.mgmt.compute.v2021_03_01.operations.CloudServicesOperations :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations - :vartype cloud_services_update_domain: azure.mgmt.compute.v2021_03_01.operations.CloudServicesUpdateDomainOperations + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 restore_point_collections: RestorePointCollectionsOperations operations - :vartype restore_point_collections: azure.mgmt.compute.v2021_03_01.operations.RestorePointCollectionsOperations + :vartype restore_point_collections: + azure.mgmt.compute.v2021_03_01.operations.RestorePointCollectionsOperations :ivar restore_points: RestorePointsOperations operations :vartype restore_points: azure.mgmt.compute.v2021_03_01.operations.RestorePointsOperations - :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_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 + :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 + :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_service_roles = CloudServiceRolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services = CloudServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( - 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.restore_point_collections = RestorePointCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( - 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 _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_service_roles = CloudServiceRolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services = CloudServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations(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.restore_point_collections = RestorePointCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations(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 _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py index f92b729da8e4..38944176fa3d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 31815024c830..72305f3f1c28 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 @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "cloud_service_role_instances": "CloudServiceRoleInstancesOperations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 8f4b2336c0e6..862abd037644 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 @@ -6,210 +6,189 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CloudServiceOperatingSystemsOperations, CloudServiceRoleInstancesOperations, CloudServiceRolesOperations, CloudServicesOperations, CloudServicesUpdateDomainOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, RestorePointCollectionsOperations, RestorePointsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -from .operations import CloudServiceRoleInstancesOperations -from .operations import CloudServiceRolesOperations -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 RestorePointCollectionsOperations -from .operations import RestorePointsOperations -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 - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations - :vartype cloud_service_role_instances: azure.mgmt.compute.v2021_03_01.aio.operations.CloudServiceRoleInstancesOperations + :vartype cloud_service_role_instances: + azure.mgmt.compute.v2021_03_01.aio.operations.CloudServiceRoleInstancesOperations :ivar cloud_service_roles: CloudServiceRolesOperations operations - :vartype cloud_service_roles: azure.mgmt.compute.v2021_03_01.aio.operations.CloudServiceRolesOperations + :vartype cloud_service_roles: + azure.mgmt.compute.v2021_03_01.aio.operations.CloudServiceRolesOperations :ivar cloud_services: CloudServicesOperations operations :vartype cloud_services: azure.mgmt.compute.v2021_03_01.aio.operations.CloudServicesOperations :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations - :vartype cloud_services_update_domain: azure.mgmt.compute.v2021_03_01.aio.operations.CloudServicesUpdateDomainOperations + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 + :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 restore_point_collections: RestorePointCollectionsOperations operations - :vartype restore_point_collections: azure.mgmt.compute.v2021_03_01.aio.operations.RestorePointCollectionsOperations + :vartype restore_point_collections: + azure.mgmt.compute.v2021_03_01.aio.operations.RestorePointCollectionsOperations :ivar restore_points: RestorePointsOperations operations :vartype restore_points: azure.mgmt.compute.v2021_03_01.aio.operations.RestorePointsOperations - :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_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 + :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 + :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_service_roles = CloudServiceRolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services = CloudServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations(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.restore_point_collections = RestorePointCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations(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) + - self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_service_roles = CloudServiceRolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services = CloudServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( - 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.restore_point_collections = RestorePointCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( - 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 _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py index 8a605cd013b8..1cc3d14b99e3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file 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 index 090b47181162..7d7d171fba9a 100644 --- 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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] + :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"] @@ -304,36 +285,31 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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] + :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"] @@ -375,35 +355,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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] + :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"] @@ -449,36 +429,33 @@ def list_available_sizes( 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py index 52cd631931c8..eb87cba90c2b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_service_operating_systems_operations import build_get_os_family_request, build_get_os_version_request, build_list_os_families_request, build_list_os_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_os_version( self, location: str, @@ -64,27 +70,17 @@ async def get_os_version( 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_os_version.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'osVersionName': self._serialize.url("os_version_name", os_version_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 = build_get_os_version_request( + location=location, + os_version_name=os_version_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +94,11 @@ async def get_os_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_os_version.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}'} # type: ignore + + @distributed_trace def list_os_versions( self, location: str, @@ -113,7 +112,8 @@ def list_os_versions( :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 OSVersionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSVersionListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSVersionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OSVersionListResult"] @@ -121,35 +121,31 @@ def list_os_versions( 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_os_versions.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_versions_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_os_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_versions_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OSVersionListResult', pipeline_response) + deserialized = self._deserialize("OSVersionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -167,11 +163,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_os_versions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions'} # type: ignore + @distributed_trace_async async def get_os_family( self, location: str, @@ -195,27 +193,17 @@ async def get_os_family( 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_os_family.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'osFamilyName': self._serialize.url("os_family_name", os_family_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 = build_get_os_family_request( + location=location, + os_family_name=os_family_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_family.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -229,8 +217,11 @@ async def get_os_family( return cls(pipeline_response, deserialized, {}) return deserialized + get_os_family.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}'} # type: ignore + + @distributed_trace def list_os_families( self, location: str, @@ -244,7 +235,8 @@ def list_os_families( :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 OSFamilyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSFamilyListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSFamilyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OSFamilyListResult"] @@ -252,35 +244,31 @@ def list_os_families( 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_os_families.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_families_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_os_families.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_families_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OSFamilyListResult', pipeline_response) + deserialized = self._deserialize("OSFamilyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -298,6 +286,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 3abc7d8889dd..1f939457609d 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, IO, 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_service_role_instances_operations import build_delete_request_initial, build_get_instance_view_request, build_get_remote_desktop_file_request, build_get_request, build_list_request, build_rebuild_request_initial, build_reimage_request_initial, build_restart_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _delete_initial( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -89,6 +84,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, role_instance_name: str, @@ -106,15 +103,17 @@ async def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -129,22 +128,14 @@ async def begin_delete( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -156,8 +147,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + @distributed_trace_async async def get( self, role_instance_name: str, @@ -187,30 +180,19 @@ async def get( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -224,8 +206,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, role_instance_name: str, @@ -251,28 +236,18 @@ async def get_instance_view( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -286,8 +261,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -307,8 +285,10 @@ def list( cloud services. :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] + :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] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] @@ -316,38 +296,35 @@ def list( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleInstanceListResult', pipeline_response) + deserialized = self._deserialize("RoleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -365,6 +342,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -382,28 +360,18 @@ async def _restart_initial( 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._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_restart_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -416,6 +384,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, role_instance_name: str, @@ -434,15 +404,17 @@ async def begin_restart( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -457,22 +429,14 @@ async def begin_restart( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -484,6 +448,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore async def _reimage_initial( @@ -498,28 +463,18 @@ async def _reimage_initial( 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._reimage_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_reimage_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -532,6 +487,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, role_instance_name: str, @@ -550,15 +507,17 @@ async def begin_reimage( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -573,22 +532,14 @@ async def begin_reimage( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -600,6 +551,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore async def _rebuild_initial( @@ -614,28 +566,18 @@ async def _rebuild_initial( 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._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_rebuild_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -648,6 +590,8 @@ async def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + @distributed_trace_async async def begin_rebuild( self, role_instance_name: str, @@ -667,15 +611,17 @@ async def begin_rebuild( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -690,22 +636,14 @@ async def begin_rebuild( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -717,8 +655,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + @distributed_trace_async async def get_remote_desktop_file( self, role_instance_name: str, @@ -744,28 +684,18 @@ async def get_remote_desktop_file( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/x-rdp" - - # Construct URL - url = self.get_remote_desktop_file.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_remote_desktop_file_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_remote_desktop_file.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) response = pipeline_response.http_response @@ -779,4 +709,6 @@ async def get_remote_desktop_file( return cls(pipeline_response, deserialized, {}) return deserialized + get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py index ebf9a776278a..718bd790c196 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_service_roles_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, role_name: str, @@ -66,28 +72,18 @@ async def get( 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 = { - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_name=role_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +97,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -117,8 +116,10 @@ def list( :param cloud_service_name: :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceRoleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleListResult] + :return: An iterator like instance of either CloudServiceRoleListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] @@ -126,36 +127,33 @@ def list( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceRoleListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceRoleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -173,6 +171,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py index b59a252f5564..0b53e785e562 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_services_operations import build_create_or_update_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_all_request, build_list_request, build_power_off_request_initial, build_rebuild_request_initial, build_reimage_request_initial, build_restart_request_initial, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,35 +60,25 @@ async def _create_or_update_initial( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudService') + _json = self._serialize.body(parameters, 'CloudService') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CloudService or the result of cls(response) + :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 CloudService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}'} # type: ignore async def _update_initial( @@ -187,35 +184,25 @@ async def _update_initial( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudServiceUpdate') + _json = self._serialize.body(parameters, 'CloudServiceUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,8 +216,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -248,15 +238,19 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CloudService or the result of cls(response) + :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 CloudService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -268,27 +262,21 @@ async def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -300,6 +288,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore async def _delete_initial( @@ -313,27 +302,17 @@ async def _delete_initial( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -346,6 +325,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -360,15 +341,17 @@ async def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,21 +365,14 @@ async def begin_delete( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -408,8 +384,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -432,27 +410,17 @@ async def get( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +434,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -490,27 +461,17 @@ async def get_instance_view( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -524,8 +485,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + + @distributed_trace def list_all( self, **kwargs: Any @@ -535,8 +499,10 @@ def list_all( till nextLink is null to fetch all the Cloud Services. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -544,34 +510,29 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -589,11 +550,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -606,8 +569,10 @@ def list( :param resource_group_name: 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 CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -615,35 +580,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -661,6 +622,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -677,27 +639,17 @@ async def _start_initial( 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._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_start_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -710,6 +662,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -724,15 +678,17 @@ async def begin_start( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -746,21 +702,14 @@ async def begin_start( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -772,6 +721,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore async def _power_off_initial( @@ -785,27 +735,17 @@ async def _power_off_initial( 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._power_off_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -818,6 +758,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -833,15 +775,17 @@ async def begin_power_off( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -855,21 +799,14 @@ async def begin_power_off( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -881,6 +818,7 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/poweroff'} # type: ignore async def _restart_initial( @@ -895,35 +833,25 @@ async def _restart_initial( 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._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -936,6 +864,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -953,15 +883,18 @@ async def begin_restart( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -973,24 +906,18 @@ async def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1002,6 +929,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore async def _reimage_initial( @@ -1016,35 +944,25 @@ async def _reimage_initial( 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._reimage_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1057,6 +975,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1075,15 +995,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1095,24 +1018,18 @@ async def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1124,6 +1041,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore async def _rebuild_initial( @@ -1138,35 +1056,25 @@ async def _rebuild_initial( 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._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_rebuild_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1179,6 +1087,8 @@ async def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + @distributed_trace_async async def begin_rebuild( self, resource_group_name: str, @@ -1198,15 +1108,18 @@ async def begin_rebuild( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1218,24 +1131,18 @@ async def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1247,6 +1154,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore async def _delete_instances_initial( @@ -1261,35 +1169,25 @@ async def _delete_instances_initial( 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._delete_instances_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1302,6 +1200,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -1319,15 +1219,18 @@ async def begin_delete_instances( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1339,24 +1242,18 @@ async def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1368,4 +1265,5 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/delete'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py index 766571c92cb1..91864e8a75be 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_services_update_domain_operations import build_get_update_domain_request, build_list_update_domains_request, build_walk_update_domain_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,36 +61,26 @@ async def _walk_update_domain_initial( 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._walk_update_domain_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateDomain') + _json = self._serialize.body(parameters, 'UpdateDomain') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_walk_update_domain_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._walk_update_domain_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,6 +93,8 @@ async def _walk_update_domain_initial( _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace_async async def begin_walk_update_domain( self, resource_group_name: str, @@ -120,15 +117,18 @@ async def begin_walk_update_domain( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -141,25 +141,18 @@ async def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - '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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,8 +164,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + @distributed_trace_async async def get_update_domain( self, resource_group_name: str, @@ -202,28 +197,18 @@ async def get_update_domain( 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_update_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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 = build_get_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + template_url=self.get_update_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +222,11 @@ async def get_update_domain( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace def list_update_domains( self, resource_group_name: str, @@ -252,8 +240,10 @@ def list_update_domains( :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UpdateDomainListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.UpdateDomainListResult] + :return: An iterator like instance of either UpdateDomainListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] @@ -261,36 +251,33 @@ def list_update_domains( 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_update_domains.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_update_domains.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UpdateDomainListResult', pipeline_response) + deserialized = self._deserialize("UpdateDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -308,6 +295,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index 2dd74f766ef8..0dc6b9422d99 100644 --- 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -259,29 +245,18 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +270,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -308,8 +286,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] + :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"] @@ -317,35 +297,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -363,11 +339,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -376,8 +354,10 @@ def list_by_subscription( 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] + :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"] @@ -385,34 +365,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,6 +405,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index e338a5de099b..2ec4b8393802 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -505,8 +476,10 @@ def list_by_host_group( :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] + :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"] @@ -514,36 +487,33 @@ def list_by_host_group( 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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -561,6 +531,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index e70af2b946a9..d25b1e793ec5 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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] + :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"] @@ -487,35 +458,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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] + :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"] @@ -555,34 +525,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index 9a1245d09868..8cc110a95cb9 100644 --- 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 @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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 index 3bf52baf9d4f..4ac4a8edf800 100644 --- 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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] + :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"] @@ -57,30 +65,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index fdbc2d3ba747..c2912e1dafa2 100644 --- 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -256,29 +242,18 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +267,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,8 +279,10 @@ def list_by_subscription( """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] + :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"] @@ -310,34 +290,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,11 +330,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -370,8 +347,10 @@ def list_by_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] + :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"] @@ -379,35 +358,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,6 +400,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py index 0f5612892d81..7291c9aba655 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restore_point_collections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_all_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -71,32 +77,22 @@ async def create_or_update( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollection') - 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 @@ -114,8 +110,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -141,32 +140,22 @@ async def update( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - 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 @@ -180,8 +169,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -193,27 +184,17 @@ async def _delete_initial( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +207,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -241,15 +224,17 @@ async def begin_delete( :type restore_point_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -263,21 +248,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -289,8 +267,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -317,29 +297,18 @@ async def get( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,8 +322,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -365,8 +337,10 @@ def list( :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 RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -374,35 +348,31 @@ def list( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -420,11 +390,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -434,8 +406,10 @@ def list_all( to fetch all the restore point collections. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -443,34 +417,29 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -488,6 +457,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py index 8b4f495dfbae..1745064562c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restore_points_operations import build_create_request_initial, build_delete_request_initial, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_initial( 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_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RestorePoint') - # 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') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePoint') - 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 @@ -95,8 +89,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -118,15 +115,19 @@ async def begin_create( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RestorePoint :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of cls(response) + :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 RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,28 +140,21 @@ async def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +166,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore async def _delete_initial( @@ -186,28 +181,18 @@ async def _delete_initial( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,6 +205,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -237,15 +224,17 @@ async def begin_delete( :type restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -260,22 +249,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -287,8 +268,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -314,28 +297,18 @@ async def get( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -349,4 +322,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # 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 index acd85a33383f..a02de3948d9a 100644 --- 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._ssh_public_keys_operations import build_create_request, build_delete_request, build_generate_key_pair_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -49,8 +55,10 @@ def list_by_subscription( 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] + :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"] @@ -58,34 +66,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,11 +106,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -119,8 +124,10 @@ def list_by_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 SshPublicKeysGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] + :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"] @@ -128,35 +135,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,11 +177,13 @@ async def get_next(next_link=None): 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 + @distributed_trace_async async def create( self, resource_group_name: str, @@ -204,32 +209,22 @@ async def create( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyResource') - # 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') + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,8 +242,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -274,32 +272,22 @@ async def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,8 +301,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -337,25 +328,17 @@ async def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,6 +351,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -390,27 +375,17 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +399,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def generate_key_pair( self, resource_group_name: str, @@ -450,27 +428,17 @@ async def generate_key_pair( 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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,4 +452,6 @@ async def generate_key_pair( 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 index 783c8cc74027..21968a22d118 100644 --- 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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] + :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"] @@ -61,35 +68,31 @@ def list( 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index cfe837745168..c47dfe099fef 100644 --- 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 @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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 index b902567b5112..b5c1f2961b43 100644 --- 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 @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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 index b2b666ac9b7d..ef6b67c6ae41 100644 --- 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 @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_edge_zone_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -74,31 +79,21 @@ async def get( 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 = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -112,8 +107,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -156,36 +154,23 @@ async def list( 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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,8 +184,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -227,28 +215,18 @@ async def list_offers( 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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -262,8 +240,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -286,27 +267,17 @@ async def list_publishers( 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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -320,8 +291,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -351,29 +325,19 @@ async def list_skus( 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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -387,4 +351,6 @@ async def list_skus( 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 index 40be7a6aeea4..a9e99dbab7c3 100644 --- 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 @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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 index 674658d9389d..034b1e783e77 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_by_virtual_machine_request, build_get_request, build_list_by_virtual_machine_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,8 +59,10 @@ def list( :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] + :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"] @@ -62,35 +70,31 @@ def list( 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,11 +112,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -135,27 +141,17 @@ async def get( 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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -169,8 +165,10 @@ async def get( 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, @@ -184,33 +182,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -228,8 +216,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_create_or_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,28 +268,21 @@ async def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,6 +294,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -320,33 +310,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +340,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -382,15 +365,20 @@ async def begin_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -403,28 +391,21 @@ async def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,6 +417,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -450,28 +432,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,6 +456,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -501,15 +475,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -524,22 +500,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -551,8 +519,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_by_virtual_machine( self, resource_group_name: str, @@ -581,30 +551,19 @@ async def get_by_virtual_machine( 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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -618,8 +577,11 @@ async def get_by_virtual_machine( 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 + + @distributed_trace def list_by_virtual_machine( self, resource_group_name: str, @@ -636,8 +598,10 @@ def list_by_virtual_machine( :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] + :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"] @@ -645,38 +609,35 @@ def list_by_virtual_machine( 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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +655,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index 11c35803ca09..7ed5b1abbc94 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -193,33 +191,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,18 +248,24 @@ async def begin_update( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,28 +278,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -314,6 +304,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -328,26 +319,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +362,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +387,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,8 +406,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -457,30 +438,19 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -494,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -509,8 +482,10 @@ def list( :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] + :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"] @@ -518,36 +493,33 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -565,6 +537,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index accfb264751b..a4c70309453a 100644 --- 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 @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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 index cd9ad9621670..0884ba7dac5c 100644 --- 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 @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -124,18 +121,24 @@ async def begin_create_or_update( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,18 +252,24 @@ async def begin_update( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,29 +283,21 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -322,6 +309,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -337,29 +325,19 @@ async def _delete_initial( 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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -372,6 +350,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +372,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,23 +398,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,8 +417,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -477,31 +452,20 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -515,8 +479,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -545,30 +512,19 @@ async def list( 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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -582,4 +538,6 @@ async def list( 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 index 9e4a63faa5a3..fe147930f84d 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -102,8 +97,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +125,20 @@ async def begin_create_or_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -265,15 +254,20 @@ async def begin_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,29 +281,21 @@ async def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -321,6 +307,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -336,29 +323,19 @@ async def _delete_initial( 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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -371,6 +348,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -391,15 +370,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,23 +396,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -443,8 +415,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -476,31 +450,20 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -514,8 +477,11 @@ async def get( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -535,8 +501,10 @@ def list( :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] + :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"] @@ -544,39 +512,37 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -594,6 +560,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index 34a178ae4208..116ae777063d 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -547,28 +514,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -581,6 +539,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -602,15 +562,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -626,22 +588,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -653,8 +607,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -685,30 +641,19 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -722,8 +667,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -749,28 +697,18 @@ async def get_instance_view( 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -784,8 +722,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -811,8 +752,10 @@ def list( '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] + :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"] @@ -820,42 +763,39 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -873,6 +813,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -891,28 +832,19 @@ async def _power_off_initial( 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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -925,6 +857,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -949,15 +883,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -973,22 +909,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1000,6 +928,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1014,26 +943,18 @@ async def _restart_initial( 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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1046,6 +967,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1063,15 +986,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1086,22 +1011,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1113,6 +1030,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1127,26 +1045,18 @@ async def _start_initial( 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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1159,6 +1069,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1176,15 +1088,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1199,22 +1113,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1226,6 +1132,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1240,26 +1147,18 @@ async def _redeploy_initial( 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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1272,6 +1171,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1290,15 +1191,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1313,22 +1216,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1340,8 +1235,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1373,30 +1270,19 @@ async def retrieve_boot_diagnostics_data( 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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1410,8 +1296,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1424,26 +1312,18 @@ async def _perform_maintenance_initial( 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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1456,6 +1336,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1473,15 +1355,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1496,22 +1380,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1523,8 +1399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -1550,26 +1428,18 @@ async def simulate_eviction( 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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1582,6 +1452,7 @@ async def simulate_eviction( 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, @@ -1595,33 +1466,23 @@ async def _run_command_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1637,8 +1498,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1659,15 +1523,20 @@ async def begin_run_command( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1680,28 +1549,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1713,4 +1575,5 @@ def get_long_running_output(pipeline_response): ) 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 index 1c609d1faf25..9f56014da148 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_by_location_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_set_orchestration_service_state_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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] + :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"] @@ -62,35 +70,31 @@ def list_by_location( 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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -168,8 +163,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -187,15 +185,20 @@ async def begin_create_or_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +210,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -239,6 +236,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -253,32 +251,22 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +280,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -311,15 +302,20 @@ async def begin_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,27 +327,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -363,6 +353,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -377,27 +368,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,6 +392,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -427,15 +411,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -450,21 +436,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -476,8 +455,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -505,29 +486,18 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -541,8 +511,10 @@ async def get( 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, @@ -555,33 +527,25 @@ async def _deallocate_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,6 +558,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -610,18 +576,22 @@ async def begin_deallocate( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,24 +603,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -662,6 +626,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -677,32 +642,23 @@ async def _delete_instances_initial( 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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -715,6 +671,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -730,21 +688,25 @@ async def begin_delete_instances( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -757,24 +719,18 @@ async def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -786,8 +742,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -810,27 +768,17 @@ async def get_instance_view( 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -844,8 +792,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -856,8 +807,10 @@ def list( :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] + :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"] @@ -865,35 +818,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -911,11 +860,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -925,8 +876,10 @@ def list_all( 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] + :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"] @@ -934,34 +887,29 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -979,11 +927,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -998,8 +948,10 @@ def list_skus( :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] + :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"] @@ -1007,36 +959,33 @@ def list_skus( 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1054,11 +1003,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -1072,8 +1023,10 @@ def get_os_upgrade_history( :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] + :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"] @@ -1081,36 +1034,33 @@ def get_os_upgrade_history( 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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1128,6 +1078,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1146,35 +1097,26 @@ async def _power_off_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1187,6 +1129,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1208,18 +1152,22 @@ async def begin_power_off( 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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1232,24 +1180,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1261,6 +1203,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1275,33 +1218,25 @@ async def _restart_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1314,6 +1249,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1328,18 +1265,22 @@ async def begin_restart( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1351,24 +1292,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1380,6 +1315,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1394,33 +1330,25 @@ async def _start_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1433,6 +1361,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1447,18 +1377,22 @@ async def begin_start( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1470,24 +1404,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1499,6 +1427,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1513,33 +1442,25 @@ async def _redeploy_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1552,6 +1473,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1567,18 +1490,22 @@ async def begin_redeploy( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1590,24 +1517,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1619,6 +1540,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1633,33 +1555,25 @@ async def _perform_maintenance_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1672,6 +1586,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1689,18 +1605,22 @@ async def begin_perform_maintenance( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1712,24 +1632,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1741,6 +1655,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1755,30 +1670,22 @@ async def _update_instances_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1791,6 +1698,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1805,18 +1714,22 @@ async def begin_update_instances( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1828,24 +1741,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1857,6 +1764,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1871,33 +1779,25 @@ async def _reimage_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1910,6 +1810,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1926,18 +1828,22 @@ async def begin_reimage( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1949,24 +1855,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1978,6 +1878,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1992,33 +1893,25 @@ async def _reimage_all_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2031,6 +1924,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -2046,18 +1941,22 @@ async def begin_reimage_all( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2069,24 +1968,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2098,8 +1991,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2127,28 +2022,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2162,8 +2047,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2178,7 +2066,8 @@ async def convert_to_single_placement_group( :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 + :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 @@ -2189,30 +2078,22 @@ async def convert_to_single_placement_group( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2225,6 +2106,7 @@ async def convert_to_single_placement_group( 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, @@ -2237,30 +2119,22 @@ async def _set_orchestration_service_state_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2273,6 +2147,8 @@ async def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace_async async def begin_set_orchestration_service_state( self, resource_group_name: str, @@ -2290,15 +2166,18 @@ async def begin_set_orchestration_service_state( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2310,24 +2189,18 @@ async def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2339,4 +2212,5 @@ def get_long_running_output(pipeline_response): ) 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 index a43a681617a8..78383e79a38f 100644 --- 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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] + :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"] @@ -61,35 +69,31 @@ def list( 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 index 8c7e2a22a121..47a21036d383 100644 --- 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_assess_patches_request_initial, build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_install_patches_request_initial, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_reapply_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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] + :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"] @@ -62,35 +70,31 @@ def list_by_location( 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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -315,15 +306,20 @@ async def begin_create_or_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -367,6 +357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +372,22 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,8 +401,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,15 +423,20 @@ async def begin_update( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,27 +448,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -491,6 +474,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -505,27 +489,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +513,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -551,20 +528,21 @@ async def begin_delete( :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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,21 +557,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -605,8 +576,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -635,29 +608,18 @@ async def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -671,8 +633,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -695,27 +660,17 @@ async def instance_view( 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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -729,8 +684,10 @@ async def instance_view( 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, @@ -742,25 +699,17 @@ async def _convert_to_managed_disks_initial( 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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -773,6 +722,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -788,15 +739,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -810,21 +763,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -836,6 +782,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -849,25 +796,17 @@ async def _deallocate_initial( 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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -880,6 +819,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -895,15 +836,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -917,21 +860,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -943,8 +879,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -972,25 +910,17 @@ async def generalize( 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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1003,6 +933,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1014,8 +946,10 @@ def list( :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] + :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"] @@ -1023,35 +957,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1069,11 +999,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1086,8 +1018,10 @@ def list_all( 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] + :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"] @@ -1095,36 +1029,31 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1142,11 +1071,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1161,8 +1092,10 @@ def list_available_sizes( :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] + :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"] @@ -1170,36 +1103,33 @@ def list_available_sizes( 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1217,6 +1147,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1234,27 +1165,18 @@ async def _power_off_initial( 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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1267,6 +1189,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1287,15 +1211,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1310,21 +1236,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1336,6 +1255,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1349,27 +1269,17 @@ async def _reapply_initial( 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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1382,6 +1292,8 @@ async def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace_async async def begin_reapply( self, resource_group_name: str, @@ -1396,15 +1308,17 @@ async def begin_reapply( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1418,21 +1332,14 @@ async def begin_reapply( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1444,6 +1351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1457,25 +1365,17 @@ async def _restart_initial( 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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1488,6 +1388,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1502,15 +1404,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1524,21 +1428,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1550,6 +1447,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1563,25 +1461,17 @@ async def _start_initial( 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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1594,6 +1484,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1608,15 +1500,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1630,21 +1524,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1656,6 +1543,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1669,25 +1557,17 @@ async def _redeploy_initial( 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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1700,6 +1580,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1714,15 +1596,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,21 +1620,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1762,6 +1639,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1776,33 +1654,25 @@ async def _reimage_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1815,6 +1685,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1832,15 +1704,18 @@ async def begin_reimage( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1852,24 +1727,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1881,8 +1750,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1910,29 +1781,18 @@ async def retrieve_boot_diagnostics_data( 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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1946,8 +1806,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1959,25 +1821,17 @@ async def _perform_maintenance_initial( 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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1990,6 +1844,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -2004,15 +1860,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2026,21 +1884,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2052,8 +1903,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -2076,25 +1929,17 @@ async def simulate_eviction( 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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2107,6 +1952,7 @@ async def simulate_eviction( 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, @@ -2118,27 +1964,17 @@ async def _assess_patches_initial( 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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2154,8 +1990,11 @@ async def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace_async async def begin_assess_patches( self, resource_group_name: str, @@ -2170,15 +2009,19 @@ async def begin_assess_patches( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2192,24 +2035,17 @@ async def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2221,6 +2057,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2235,32 +2072,22 @@ async def _install_patches_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2276,8 +2103,11 @@ async def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace_async async def begin_install_patches( self, resource_group_name: str, @@ -2292,18 +2122,24 @@ async def begin_install_patches( :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 + :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2315,27 +2151,21 @@ async def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2347,6 +2177,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2361,32 +2192,22 @@ async def _run_command_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2402,8 +2223,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -2421,15 +2245,20 @@ async def begin_run_command( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2441,27 +2270,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2473,4 +2296,5 @@ def get_long_running_output(pipeline_response): ) 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 5f2c0f57de29..6f991a0f958e 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 @@ -6,538 +6,271 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -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 - from ._models_py3 import CloudServiceInstanceView - from ._models_py3 import CloudServiceListResult - from ._models_py3 import CloudServiceNetworkProfile - from ._models_py3 import CloudServiceOsProfile - from ._models_py3 import CloudServiceProperties - from ._models_py3 import CloudServiceRole - from ._models_py3 import CloudServiceRoleListResult - from ._models_py3 import CloudServiceRoleProfile - from ._models_py3 import CloudServiceRoleProfileProperties - from ._models_py3 import CloudServiceRoleProperties - from ._models_py3 import CloudServiceRoleSku - from ._models_py3 import CloudServiceUpdate - 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 ProxyResource - from ._models_py3 import PublicIPAddressSku - 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 RestorePoint - from ._models_py3 import RestorePointCollection - from ._models_py3 import RestorePointCollectionListResult - from ._models_py3 import RestorePointCollectionSourceProperties - from ._models_py3 import RestorePointCollectionUpdate - from ._models_py3 import RestorePointProvisioningDetails - from ._models_py3 import RestorePointSourceMetadata - from ._models_py3 import RestorePointSourceVMDataDisk - from ._models_py3 import RestorePointSourceVMOSDisk - from ._models_py3 import RestorePointSourceVMStorageProfile - 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 VirtualMachineIpTag - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineNetworkInterfaceConfiguration - from ._models_py3 import VirtualMachineNetworkInterfaceDnsSettingsConfiguration - from ._models_py3 import VirtualMachineNetworkInterfaceIPConfiguration - from ._models_py3 import VirtualMachinePatchStatus - from ._models_py3 import VirtualMachinePublicIPAddressConfiguration - from ._models_py3 import VirtualMachinePublicIPAddressDnsSettingsConfiguration - 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 - from ._models import CloudServiceInstanceView # type: ignore - from ._models import CloudServiceListResult # type: ignore - from ._models import CloudServiceNetworkProfile # type: ignore - from ._models import CloudServiceOsProfile # type: ignore - from ._models import CloudServiceProperties # type: ignore - from ._models import CloudServiceRole # type: ignore - from ._models import CloudServiceRoleListResult # type: ignore - from ._models import CloudServiceRoleProfile # type: ignore - from ._models import CloudServiceRoleProfileProperties # type: ignore - from ._models import CloudServiceRoleProperties # type: ignore - from ._models import CloudServiceRoleSku # type: ignore - from ._models import CloudServiceUpdate # type: ignore - 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 ProxyResource # type: ignore - from ._models import PublicIPAddressSku # 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 RestorePoint # type: ignore - from ._models import RestorePointCollection # type: ignore - from ._models import RestorePointCollectionListResult # type: ignore - from ._models import RestorePointCollectionSourceProperties # type: ignore - from ._models import RestorePointCollectionUpdate # type: ignore - from ._models import RestorePointProvisioningDetails # type: ignore - from ._models import RestorePointSourceMetadata # type: ignore - from ._models import RestorePointSourceVMDataDisk # type: ignore - from ._models import RestorePointSourceVMOSDisk # type: ignore - from ._models import RestorePointSourceVMStorageProfile # 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 VirtualMachineIpTag # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineNetworkInterfaceConfiguration # type: ignore - from ._models import VirtualMachineNetworkInterfaceDnsSettingsConfiguration # type: ignore - from ._models import VirtualMachineNetworkInterfaceIPConfiguration # type: ignore - from ._models import VirtualMachinePatchStatus # type: ignore - from ._models import VirtualMachinePublicIPAddressConfiguration # type: ignore - from ._models import VirtualMachinePublicIPAddressDnsSettingsConfiguration # 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 ._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 +from ._models_py3 import CloudServiceInstanceView +from ._models_py3 import CloudServiceListResult +from ._models_py3 import CloudServiceNetworkProfile +from ._models_py3 import CloudServiceOsProfile +from ._models_py3 import CloudServiceProperties +from ._models_py3 import CloudServiceRole +from ._models_py3 import CloudServiceRoleListResult +from ._models_py3 import CloudServiceRoleProfile +from ._models_py3 import CloudServiceRoleProfileProperties +from ._models_py3 import CloudServiceRoleProperties +from ._models_py3 import CloudServiceRoleSku +from ._models_py3 import CloudServiceUpdate +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 ProxyResource +from ._models_py3 import PublicIPAddressSku +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 RestorePoint +from ._models_py3 import RestorePointCollection +from ._models_py3 import RestorePointCollectionListResult +from ._models_py3 import RestorePointCollectionSourceProperties +from ._models_py3 import RestorePointCollectionUpdate +from ._models_py3 import RestorePointSourceMetadata +from ._models_py3 import RestorePointSourceVMDataDisk +from ._models_py3 import RestorePointSourceVMOSDisk +from ._models_py3 import RestorePointSourceVMStorageProfile +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 VirtualMachineIpTag +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineNetworkInterfaceConfiguration +from ._models_py3 import VirtualMachineNetworkInterfaceDnsSettingsConfiguration +from ._models_py3 import VirtualMachineNetworkInterfaceIPConfiguration +from ._models_py3 import VirtualMachinePatchStatus +from ._models_py3 import VirtualMachinePublicIPAddressConfiguration +from ._models_py3 import VirtualMachinePublicIPAddressDnsSettingsConfiguration +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 + from ._compute_management_client_enums import ( AvailabilitySetSkuTypes, @@ -723,7 +456,6 @@ 'RestorePointCollectionListResult', 'RestorePointCollectionSourceProperties', 'RestorePointCollectionUpdate', - 'RestorePointProvisioningDetails', 'RestorePointSourceMetadata', 'RestorePointSourceVMDataDisk', 'RestorePointSourceVMOSDisk', 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 c0e1441907db..76e611e2dc12 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 @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -34,7 +19,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -45,7 +30,7 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class CloudServiceUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 automatically in all update domains. @@ -60,7 +45,7 @@ class CloudServiceUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum MANUAL = "Manual" SIMULTANEOUS = "Simultaneous" -class ConsistencyModeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConsistencyModeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the consistency mode for the restore point. Please refer to https://aka.ms/RestorePoints for more details. """ @@ -69,7 +54,7 @@ class ConsistencyModeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_SYSTEM_CONSISTENT = "FileSystemConsistent" APPLICATION_CONSISTENT = "ApplicationConsistent" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -80,20 +65,20 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DeleteOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify what happens to the network interface when the VM is deleted """ DELETE = "Delete" DETACH = "Detach" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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 @@ -106,7 +91,7 @@ class DiffDiskPlacement(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CACHE_DISK = "CacheDisk" RESOURCE_DISK = "ResourceDisk" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -119,7 +104,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class DiskDeleteOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskDeleteOptionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the behavior of the managed disk when the VM gets deleted i.e whether the managed disk is deleted or detached. Supported values::code:`
    `:code:`
    ` **Delete** If this value is used, the managed disk is deleted when VM gets deleted.:code:`
    `:code:`
    ` **Detach** @@ -130,7 +115,7 @@ class DiskDeleteOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DETACH = "Detach" -class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -144,7 +129,7 @@ class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) FORCE_DETACH = "ForceDetach" -class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExecutionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Script execution status. """ @@ -156,36 +141,36 @@ class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TIMED_OUT = "TimedOut" CANCELED = "Canceled" -class ExpandTypesForGetVMScaleSets(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpandTypesForGetVMScaleSets(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_DATA = "userData" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class InstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTANCE_VIEW = "instanceView" USER_DATA = "userData" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -194,7 +179,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -203,7 +188,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class IPVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IPVersions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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'. @@ -212,7 +197,7 @@ class IPVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class LinuxPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinuxPatchAssessmentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` @@ -223,7 +208,7 @@ class LinuxPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinuxVMGuestPatchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - The virtual machine's @@ -235,7 +220,7 @@ class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -244,14 +229,14 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class NetworkApiVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkApiVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations """ TWO_THOUSAND_TWENTY11_01 = "2020-11-01" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -260,35 +245,35 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class OrchestrationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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)): +class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. """ @@ -296,21 +281,21 @@ class OrchestrationServiceState(with_metaclass(_CaseInsensitiveEnumMeta, str, En RUNNING = "Running" SUSPENDED = "Suspended" -class OrchestrationServiceStateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrchestrationServiceStateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action to be performed. """ RESUME = "Resume" SUSPEND = "Suspend" -class PatchAssessmentState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class PatchInstallationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the patch after the installation operation completed. """ @@ -321,7 +306,7 @@ class PatchInstallationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) NOT_SELECTED = "NotSelected" PENDING = "Pending" -class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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." @@ -333,7 +318,7 @@ class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -341,7 +326,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -350,28 +335,28 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class PublicIPAddressSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAddressSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify public IP sku name """ BASIC = "Basic" STANDARD = "Standard" -class PublicIPAddressSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAddressSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify public IP sku tier """ REGIONAL = "Regional" GLOBAL_ENUM = "Global" -class PublicIPAllocationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAllocationMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify the public IP allocation type """ DYNAMIC = "Dynamic" STATIC = "Static" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -382,18 +367,18 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RestorePointCollectionExpandOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestorePointCollectionExpandOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RESTORE_POINTS = "restorePoints" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -402,7 +387,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. @@ -410,7 +395,7 @@ class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TRUSTED_LAUNCH = "TrustedLaunch" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -418,7 +403,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -426,7 +411,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. @@ -443,7 +428,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PREMIUM_ZRS = "Premium_ZRS" STANDARD_SSD_ZRS = "StandardSSD_ZRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -455,7 +440,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -463,7 +448,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -472,14 +457,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -489,20 +474,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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: @@ -684,20 +669,20 @@ class VirtualMachineSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum STANDARD_NV12 = "Standard_NV12" STANDARD_NV24 = "Standard_NV24" -class VmDiskTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VmDiskTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """VM disk types which are disallowed. """ NONE = "None" UNMANAGED = "Unmanaged" -class VMGuestPatchClassificationLinux(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationLinux(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" OTHER = "Other" -class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationWindows(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" @@ -708,7 +693,7 @@ class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, TOOLS = "Tools" UPDATES = "Updates" -class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the reboot requirements of the patch. """ @@ -717,7 +702,7 @@ class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, E ALWAYS_REQUIRES_REBOOT = "AlwaysRequiresReboot" CAN_REQUEST_REBOOT = "CanRequestReboot" -class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines when it is acceptable to reboot a VM during a software update operation. """ @@ -725,7 +710,7 @@ class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, En NEVER = "Never" ALWAYS = "Always" -class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reboot state of the VM following completion of the operation. """ @@ -736,7 +721,7 @@ class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu FAILED = "Failed" COMPLETED = "Completed" -class WindowsPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WindowsPatchAssessmentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` @@ -747,7 +732,7 @@ class WindowsPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, E IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class WindowsVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WindowsVMGuestPatchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Manual** - You control the application of 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 deleted file mode 100644 index 7aaf0d22ba00..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models.py +++ /dev/null @@ -1,11132 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2021_03_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2021_03_01.models.InnerError - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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 `Availability sets overview `_. :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance and updates 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. - - 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 = { - '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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 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, - **kwargs - ): - 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 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, - **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 - 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, - **kwargs - ): - super(CloudServiceNetworkProfile, self).__init__(**kwargs) - self.load_balancer_configurations = kwargs.get('load_balancer_configurations', None) - self.swappable_cloud_service = kwargs.get('swappable_cloud_service', None) - - -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, - **kwargs - ): - super(CloudServiceOsProfile, self).__init__(**kwargs) - self.secrets = kwargs.get('secrets', None) - - -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, - **kwargs - ): - super(CloudServiceProperties, self).__init__(**kwargs) - self.package_url = kwargs.get('package_url', None) - self.configuration = kwargs.get('configuration', None) - self.configuration_url = kwargs.get('configuration_url', None) - self.start_cloud_service = kwargs.get('start_cloud_service', None) - self.allow_model_override = kwargs.get('allow_model_override', None) - self.upgrade_mode = kwargs.get('upgrade_mode', None) - self.role_profile = kwargs.get('role_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.network_profile = kwargs.get('network_profile', None) - self.extension_profile = kwargs.get('extension_profile', None) - 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, - **kwargs - ): - super(CloudServiceRole, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.sku = kwargs.get('sku', None) - self.properties = kwargs.get('properties', None) - - -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, - **kwargs - ): - super(CloudServiceRoleListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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, - **kwargs - ): - super(CloudServiceRoleProfile, self).__init__(**kwargs) - self.roles = kwargs.get('roles', None) - - -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, - **kwargs - ): - super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.sku = kwargs.get('sku', None) - - -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, - **kwargs - ): - super(CloudServiceRoleSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - self.capacity = kwargs.get('capacity', None) - - -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, - **kwargs - ): - super(CloudServiceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -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, - **kwargs - ): - super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.secret_url = kwargs.get('secret_url', None) - - -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, - **kwargs - ): - super(CloudServiceVaultCertificate, self).__init__(**kwargs) - self.certificate_url = kwargs.get('certificate_url', None) - - -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, - **kwargs - ): - super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.vault_certificates = kwargs.get('vault_certificates', None) - - -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 - :param delete_option: Specifies whether data disk should be deleted or detached upon VM - deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this - value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** - If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` - The default value is set to **detach**. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes - """ - - _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'}, - 'delete_option': {'key': 'deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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) - self.delete_option = kwargs.get('delete_option', None) - - -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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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, - **kwargs - ): - 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 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. 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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', None) - - -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, - **kwargs - ): - 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/azure/virtual-machines/windows/sizes and Linux VM at - https://docs.microsoft.com/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 `_. - - :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 or virtual - machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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 - :param assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual - machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` - **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch - assessments. The property provisionVMAgent must be true. Possible values include: - "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchAssessmentMode - """ - - _attribute_map = { - 'patch_mode': {'key': 'patchMode', 'type': 'str'}, - 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LinuxPatchSettings, self).__init__(**kwargs) - self.patch_mode = kwargs.get('patch_mode', None) - self.assessment_mode = kwargs.get('assessment_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. 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. 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 - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkInterfaceReference, self).__init__(**kwargs) - self.primary = kwargs.get('primary', None) - self.delete_option = kwargs.get('delete_option', None) - - -class NetworkProfile(msrest.serialization.Model): - """Specifies the network interfaces or the networking configuration 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] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations. Possible values include: - "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion - :param network_interface_configurations: Specifies the networking configurations that will be - used to create the virtual machine networking resources. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceConfiguration] - """ - - _attribute_map = { - 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterfaceReference]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineNetworkInterfaceConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkProfile, self).__init__(**kwargs) - self.network_interfaces = kwargs.get('network_interfaces', None) - self.network_api_version = kwargs.get('network_api_version', None) - self.network_interface_configurations = kwargs.get('network_interface_configurations', 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 - :param delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. - :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is - used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this - value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The - default value is set to **detach**. For an ephemeral OS Disk, the default value is set to - **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values - include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes - """ - - _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'}, - 'delete_option': {'key': 'deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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. - :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 - `_. - :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. To install certificates on a virtual machine it is recommended to use the `Azure Key - Vault virtual machine extension for Linux - `_ or the `Azure - Key Vault virtual machine extension for Windows - `_. - :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): - """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 or virtual - machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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 - :param assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual - machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` - **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch - assessments. The property provisionVMAgent must be true. Possible values include: - "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_03_01.models.WindowsPatchAssessmentMode - """ - - _attribute_map = { - 'patch_mode': {'key': 'patchMode', 'type': 'str'}, - 'enable_hotpatching': {'key': 'enableHotpatching', 'type': 'bool'}, - 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, - } - - 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) - self.assessment_mode = kwargs.get('assessment_mode', 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 ProxyResource(msrest.serialization.Model): - """The resource model definition for an Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PublicIPAddressSku(msrest.serialization.Model): - """Describes the public IP Sku. - - :param name: Specify public IP sku name. Possible values include: "Basic", "Standard". - :type name: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuName - :param tier: Specify public IP sku tier. Possible values include: "Regional", "Global". - :type tier: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PublicIPAddressSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -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 RestorePoint(ProxyResource): - """Restore Point details. - - 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 - :param exclude_disks: List of disk resource ids that the customer wishes to exclude from the - restore point. If no disks are specified, all disks will be included. - :type exclude_disks: list[~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference] - :ivar source_metadata: Gets the details of the VM captured at the time of the restore point - creation. - :vartype source_metadata: ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceMetadata - :ivar provisioning_state: Gets the provisioning state of the restore point. - :vartype provisioning_state: str - :ivar consistency_mode: Gets the consistency mode for the restore point. Please refer to - https://aka.ms/RestorePoints for more details. Possible values include: "CrashConsistent", - "FileSystemConsistent", "ApplicationConsistent". - :vartype consistency_mode: str or ~azure.mgmt.compute.v2021_03_01.models.ConsistencyModeTypes - :ivar provisioning_details: Gets the provisioning details set by the server during Create - restore point operation. - :vartype provisioning_details: - ~azure.mgmt.compute.v2021_03_01.models.RestorePointProvisioningDetails - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'source_metadata': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'consistency_mode': {'readonly': True}, - 'provisioning_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'exclude_disks': {'key': 'properties.excludeDisks', 'type': '[ApiEntityReference]'}, - 'source_metadata': {'key': 'properties.sourceMetadata', 'type': 'RestorePointSourceMetadata'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'consistency_mode': {'key': 'properties.consistencyMode', 'type': 'str'}, - 'provisioning_details': {'key': 'properties.provisioningDetails', 'type': 'RestorePointProvisioningDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePoint, self).__init__(**kwargs) - self.exclude_disks = kwargs.get('exclude_disks', None) - self.source_metadata = None - self.provisioning_state = None - self.consistency_mode = None - self.provisioning_details = None - - -class RestorePointCollection(Resource): - """Create or update Restore Point collection parameters. - - 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 properties of the source resource that this restore point collection is - created from. - :type source: ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties - :ivar provisioning_state: The provisioning state of the restore point collection. - :vartype provisioning_state: str - :ivar restore_point_collection_id: The unique id of the restore point collection. - :vartype restore_point_collection_id: str - :ivar restore_points: A list containing all restore points created under this restore point - collection. - :vartype restore_points: list[~azure.mgmt.compute.v2021_03_01.models.RestorePoint] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'restore_point_collection_id': {'readonly': True}, - 'restore_points': {'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': 'RestorePointCollectionSourceProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, - 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollection, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None - - -class RestorePointCollectionListResult(msrest.serialization.Model): - """The List restore point collection operation response. - - :param value: Gets the list of restore point collections. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollection] - :param next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() - with this to fetch the next page of RestorePointCollections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorePointCollection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RestorePointCollectionSourceProperties(msrest.serialization.Model): - """The properties of the source resource that this restore point collection is created from. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of the source resource used to create this restore point collection. - :vartype location: str - :param id: Resource Id of the source resource used to create this restore point collection. - :type id: str - """ - - _validation = { - 'location': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionSourceProperties, self).__init__(**kwargs) - self.location = None - self.id = kwargs.get('id', None) - - -class RestorePointCollectionUpdate(UpdateResource): - """Update Restore Point collection parameters. - - 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 properties of the source resource that this restore point collection is - created from. - :type source: ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties - :ivar provisioning_state: The provisioning state of the restore point collection. - :vartype provisioning_state: str - :ivar restore_point_collection_id: The unique id of the restore point collection. - :vartype restore_point_collection_id: str - :ivar restore_points: A list containing all restore points created under this restore point - collection. - :vartype restore_points: list[~azure.mgmt.compute.v2021_03_01.models.RestorePoint] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'restore_point_collection_id': {'readonly': True}, - 'restore_points': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'source': {'key': 'properties.source', 'type': 'RestorePointCollectionSourceProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, - 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionUpdate, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None - - -class RestorePointProvisioningDetails(msrest.serialization.Model): - """Restore Point Provisioning details. - - :param creation_time: Gets the creation time of the restore point. - :type creation_time: ~datetime.datetime - :param total_used_size_in_bytes: Gets the total size of the data in all the disks which are - part of the restore point. - :type total_used_size_in_bytes: long - :param status_code: Gets the status of the Create restore point operation. - :type status_code: int - :param status_message: Gets the status message of the Create restore point operation. - :type status_message: str - """ - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'total_used_size_in_bytes': {'key': 'totalUsedSizeInBytes', 'type': 'long'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointProvisioningDetails, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.total_used_size_in_bytes = kwargs.get('total_used_size_in_bytes', None) - self.status_code = kwargs.get('status_code', None) - self.status_message = kwargs.get('status_message', None) - - -class RestorePointSourceMetadata(msrest.serialization.Model): - """Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point creation. - - :param hardware_profile: Gets the hardware profile. - :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile - :param storage_profile: Gets the storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMStorageProfile - :param os_profile: Gets the OS profile. - :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile - :param diagnostics_profile: Gets the diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile - :param license_type: Gets the license type, which is for bring your own license scenario. - :type license_type: str - :param vm_id: Gets the virtual machine unique id. - :type vm_id: str - :param security_profile: Gets the security profile. - :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile - :param location: Location of the VM from which the restore point was created. - :type location: str - """ - - _attribute_map = { - 'hardware_profile': {'key': 'hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'RestorePointSourceVMStorageProfile'}, - 'os_profile': {'key': 'osProfile', 'type': 'OSProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceMetadata, self).__init__(**kwargs) - self.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.license_type = kwargs.get('license_type', None) - self.vm_id = kwargs.get('vm_id', None) - self.security_profile = kwargs.get('security_profile', None) - self.location = kwargs.get('location', None) - - -class RestorePointSourceVMDataDisk(msrest.serialization.Model): - """Describes a data disk. - - :param lun: Gets the logical unit number. - :type lun: int - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes - :param disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired - size for existing OS and Data disks. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference - """ - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMDataDisk, self).__init__(**kwargs) - self.lun = kwargs.get('lun', None) - self.name = kwargs.get('name', None) - self.caching = kwargs.get('caching', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - self.disk_restore_point = kwargs.get('disk_restore_point', None) - - -class RestorePointSourceVMOSDisk(msrest.serialization.Model): - """Describes an Operating System disk. - - :param os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemType - :param encryption_settings: Gets the disk encryption settings. - :type encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes - :param disk_size_gb: Gets the disk size in GB. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference - """ - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': 'DiskEncryptionSettings'}, - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMOSDisk, 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.caching = kwargs.get('caching', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - self.disk_restore_point = kwargs.get('disk_restore_point', None) - - -class RestorePointSourceVMStorageProfile(msrest.serialization.Model): - """Describes the storage profile. - - :param os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. - :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMOSDisk - :param data_disks: Gets the data disks of the VM captured at the time of the restore point - creation. - :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMDataDisk] - """ - - _attribute_map = { - 'os_disk': {'key': 'osDisk', 'type': 'RestorePointSourceVMOSDisk'}, - 'data_disks': {'key': 'dataDisks', 'type': '[RestorePointSourceVMDataDisk]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMStorageProfile, self).__init__(**kwargs) - self.os_disk = kwargs.get('os_disk', None) - self.data_disks = kwargs.get('data_disks', 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. - - :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 - :param 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. Possible values include: - "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_03_01.models.SecurityTypes - """ - - _attribute_map = { - 'uefi_settings': {'key': 'uefiSettings', 'type': 'UefiSettings'}, - 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, - 'security_type': {'key': 'securityType', 'type': 'str'}, - } - - 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) - self.security_type = kwargs.get('security_type', 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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - :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: An enum describing the unit of usage measurement. Has constant 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:`
    `} :code:`
    ` To install certificates on a - virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for - Linux `_ or the - `Azure Key Vault virtual machine extension for Windows - `_. - :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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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 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 - """ - - _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'}, - 'scheduled_events_profile': {'key': 'properties.scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, - '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.scheduled_events_profile = kwargs.get('scheduled_events_profile', 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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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 VirtualMachineIpTag(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(VirtualMachineIpTag, self).__init__(**kwargs) - self.ip_tag_type = kwargs.get('ip_tag_type', None) - self.tag = kwargs.get('tag', 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 VirtualMachineNetworkInterfaceConfiguration(msrest.serialization.Model): - """Describes a virtual machine network interface configurations. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The network interface 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 delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - :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 enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: 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.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceIPConfiguration] - :param dscp_configuration: - :type dscp_configuration: ~azure.mgmt.compute.v2021_03_01.models.SubResource - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, - 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, - 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, - 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineNetworkInterfaceDnsSettingsConfiguration'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineNetworkInterfaceIPConfiguration]'}, - 'dscp_configuration': {'key': 'properties.dscpConfiguration', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineNetworkInterfaceConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.primary = kwargs.get('primary', None) - self.delete_option = kwargs.get('delete_option', None) - self.enable_accelerated_networking = kwargs.get('enable_accelerated_networking', None) - self.enable_fpga = kwargs.get('enable_fpga', None) - self.enable_ip_forwarding = kwargs.get('enable_ip_forwarding', 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.dscp_configuration = kwargs.get('dscp_configuration', None) - - -class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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(VirtualMachineNetworkInterfaceDnsSettingsConfiguration, self).__init__(**kwargs) - self.dns_servers = kwargs.get('dns_servers', None) - - -class VirtualMachineNetworkInterfaceIPConfiguration(msrest.serialization.Model): - """Describes a virtual machine network profile's IP configuration. - - All required parameters must be populated in order to send to Azure. - - :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.SubResource - :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.VirtualMachinePublicIPAddressConfiguration - :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.IPVersions - :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 application_gateway_backend_address_pools: Specifies an array of references to backend - address pools of application gateways. A virtual machine can reference backend address pools of - multiple application gateways. Multiple virtual machines cannot use the same application - gateway. - :type application_gateway_backend_address_pools: - 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 virtual machine can reference backend address pools of one public - and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load - balancer]. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2021_03_01.models.SubResource] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachinePublicIPAddressConfiguration'}, - 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, - 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, - 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, - 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineNetworkInterfaceIPConfiguration, 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_security_groups = kwargs.get('application_security_groups', None) - self.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', None) - self.load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools', 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 VirtualMachinePublicIPAddressConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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 sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku - :param idle_timeout_in_minutes: The idle timeout of the public IP address. - :type idle_timeout_in_minutes: int - :param delete_option: Specify what happens to the public IP address when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - :param dns_settings: The dns settings to be applied on the publicIP addresses . - :type dns_settings: - ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :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.VirtualMachineIpTag] - :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.IPVersions - :param public_ip_allocation_method: Specify the public IP allocation type. Possible values - include: "Dynamic", "Static". - :type public_ip_allocation_method: str or - ~azure.mgmt.compute.v2021_03_01.models.PublicIPAllocationMethod - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, - 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachinePublicIPAddressDnsSettingsConfiguration'}, - 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineIpTag]'}, - 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, - 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, - 'public_ip_allocation_method': {'key': 'properties.publicIPAllocationMethod', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachinePublicIPAddressConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.sku = kwargs.get('sku', None) - self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) - self.delete_option = kwargs.get('delete_option', 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) - self.public_ip_allocation_method = kwargs.get('public_ip_allocation_method', None) - - -class VirtualMachinePublicIPAddressDnsSettingsConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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 prefix of the PublicIPAddress - resources that will be created. The generated name label is the concatenation of the domain - name label and vm network profile unique ID. - :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(VirtualMachinePublicIPAddressDnsSettingsConfiguration, self).__init__(**kwargs) - self.domain_name_label = kwargs['domain_name_label'] - - -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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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 - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - """ - - _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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion - """ - - _attribute_map = { - 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - } - - 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) - self.network_api_version = kwargs.get('network_api_version', 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. - :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 - `_. - :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. To install certificates on a virtual machine it is recommended to - use the `Azure Key Vault virtual machine extension for Linux - `_ or the `Azure - Key Vault virtual machine extension for Windows - `_. - :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 sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku - :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 - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible - values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, - '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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.sku = kwargs.get('sku', None) - 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) - self.delete_option = kwargs.get('delete_option', 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 - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - """ - - _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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion - """ - - _attribute_map = { - 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - } - - 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) - self.network_api_version = kwargs.get('network_api_version', 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 - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible - values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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}, - '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'}, - '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(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 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: 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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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}, - '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'}, - '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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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 = { - 'vm_health': {'readonly': True}, - 'assigned_host': {'readonly': True}, - } - - _attribute_map = { - '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(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 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. 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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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 virtual machines in the scale set, 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': '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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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. For - Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM - uses. For accurate vCPU count, please refer to - https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or - https://docs.microsoft.com/rest/api/compute/resourceskus/list. - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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 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 = { - '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 = { - '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(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 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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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 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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - 'scheduled_events_profile': {'key': 'properties.scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, - 'user_data': {'key': 'properties.userData', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.scheduled_events_profile = kwargs.get('scheduled_events_profile', 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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': '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 - """ - - _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 = { - '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(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 WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2021_03_01.models.WinRMListener] - """ - - _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:`
    `} :code:`
    ` To install certificates on a - virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for - Linux `_ or the - `Azure Key Vault virtual machine extension for Windows - `_. - :type certificate_url: str - """ - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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 4263e8291154..61cbbaeabd1f 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 @@ -17,11 +17,11 @@ 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -34,6 +34,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -41,21 +48,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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 + :vartype setting_name: str or ~azure.mgmt.compute.v2021_03_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -74,6 +81,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2021_03_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -84,9 +108,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -99,6 +123,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -106,16 +135,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2021_03_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2021_03_01.models.InnerError - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2021_03_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2021_03_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str """ _attribute_map = { @@ -136,6 +165,18 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2021_03_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2021_03_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + :keyword target: The target of the particular error. + :paramtype target: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -147,12 +188,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the particular error. - :type target: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str """ _attribute_map = { @@ -169,6 +210,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + :keyword target: The target of the particular error. + :paramtype target: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.message = message @@ -178,16 +227,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -202,6 +251,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -212,9 +273,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -231,6 +292,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -238,15 +304,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -261,6 +327,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -279,10 +356,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -307,6 +384,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -328,25 +411,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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: + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :ivar 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 + :vartype 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] """ @@ -385,6 +468,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -399,11 +504,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :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 + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -422,6 +527,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -430,8 +542,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -444,6 +556,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -453,20 +569,20 @@ class AvailabilitySetUpdate(UpdateResource): 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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :ivar 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 + :vartype 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] """ @@ -496,6 +612,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -562,6 +695,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailablePatchSummary, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -576,7 +711,7 @@ def __init__( 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. + :ivar 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 @@ -588,7 +723,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -601,6 +736,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -608,12 +758,12 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar 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 + :vartype storage_uri: str """ _attribute_map = { @@ -628,6 +778,14 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword 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. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -667,6 +825,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -686,12 +846,12 @@ class CloudService(msrest.serialization.Model): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Cloud service properties. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceProperties """ _validation = { @@ -718,6 +878,14 @@ def __init__( properties: Optional["CloudServiceProperties"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Cloud service properties. + :paramtype properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceProperties + """ super(CloudService, self).__init__(**kwargs) self.id = None self.name = None @@ -730,8 +898,8 @@ def __init__( 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] + :ivar extensions: List of extensions for the cloud service. + :vartype extensions: list[~azure.mgmt.compute.v2021_03_01.models.Extension] """ _attribute_map = { @@ -744,6 +912,10 @@ def __init__( extensions: Optional[List["Extension"]] = None, **kwargs ): + """ + :keyword extensions: List of extensions for the cloud service. + :paramtype extensions: list[~azure.mgmt.compute.v2021_03_01.models.Extension] + """ super(CloudServiceExtensionProfile, self).__init__(**kwargs) self.extensions = extensions @@ -753,32 +925,32 @@ class CloudServiceExtensionProperties(msrest.serialization.Model): 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 + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension. + :vartype type: str + :ivar 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 + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Explicitly specify whether platform can automatically upgrade + typeHandlerVersion to higher minor versions when they become available. + :vartype auto_upgrade_minor_version: bool + :ivar 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 + :vartype settings: str + :ivar 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: + :vartype protected_settings: str + :ivar protected_settings_from_key_vault: + :vartype 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. + :ivar 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 @@ -786,12 +958,12 @@ class CloudServiceExtensionProperties(msrest.serialization.Model): 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 + :vartype 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 + :ivar 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] + :vartype roles_applied_to: list[str] """ _validation = { @@ -825,6 +997,45 @@ def __init__( roles_applied_to: Optional[List[str]] = None, **kwargs ): + """ + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension. + :paramtype type: str + :keyword 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. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Explicitly specify whether platform can automatically + upgrade typeHandlerVersion to higher minor versions when they become available. + :paramtype auto_upgrade_minor_version: bool + :keyword 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. + :paramtype settings: str + :keyword protected_settings: Protected settings for the extension which are encrypted before + sent to the role instance. + :paramtype protected_settings: str + :keyword protected_settings_from_key_vault: + :paramtype protected_settings_from_key_vault: + ~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultAndSecretReference + :keyword 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. + :paramtype force_update_tag: str + :keyword 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. + :paramtype roles_applied_to: list[str] + """ super(CloudServiceExtensionProperties, self).__init__(**kwargs) self.publisher = publisher self.type = type @@ -843,8 +1054,8 @@ class CloudServiceInstanceView(msrest.serialization.Model): 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 role_instance: Instance view statuses. + :vartype 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 @@ -875,6 +1086,10 @@ def __init__( role_instance: Optional["InstanceViewStatusesSummary"] = None, **kwargs ): + """ + :keyword role_instance: Instance view statuses. + :paramtype role_instance: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatusesSummary + """ super(CloudServiceInstanceView, self).__init__(**kwargs) self.role_instance = role_instance self.sdk_version = None @@ -887,10 +1102,10 @@ class CloudServiceListResult(msrest.serialization.Model): 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 + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.CloudService] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -909,6 +1124,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.CloudService] + :keyword next_link: + :paramtype next_link: str + """ super(CloudServiceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -917,16 +1138,16 @@ def __init__( class CloudServiceNetworkProfile(msrest.serialization.Model): """Network Profile for the cloud service. - :param load_balancer_configurations: List of Load balancer configurations. Cloud service can + :ivar 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: + :vartype 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 + :ivar 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 + :vartype swappable_cloud_service: ~azure.mgmt.compute.v2021_03_01.models.SubResource """ _attribute_map = { @@ -941,6 +1162,18 @@ def __init__( swappable_cloud_service: Optional["SubResource"] = None, **kwargs ): + """ + :keyword 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. + :paramtype load_balancer_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfiguration] + :keyword 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. + :paramtype swappable_cloud_service: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ super(CloudServiceNetworkProfile, self).__init__(**kwargs) self.load_balancer_configurations = load_balancer_configurations self.swappable_cloud_service = swappable_cloud_service @@ -949,8 +1182,8 @@ def __init__( 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] + :ivar secrets: Specifies set of certificates that should be installed onto the role instances. + :vartype secrets: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultSecretGroup] """ _attribute_map = { @@ -963,6 +1196,11 @@ def __init__( secrets: Optional[List["CloudServiceVaultSecretGroup"]] = None, **kwargs ): + """ + :keyword secrets: Specifies set of certificates that should be installed onto the role + instances. + :paramtype secrets: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultSecretGroup] + """ super(CloudServiceOsProfile, self).__init__(**kwargs) self.secrets = secrets @@ -972,30 +1210,30 @@ class CloudServiceProperties(msrest.serialization.Model): 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 + :ivar 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 + :vartype package_url: str + :ivar configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :vartype configuration: str + :ivar 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 + :vartype configuration_url: str + :ivar 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 + :vartype start_cloud_service: bool + :ivar 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 + :vartype allow_model_override: bool + :ivar 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:`
    `\ @@ -1003,15 +1241,15 @@ class CloudServiceProperties(msrest.serialization.Model): 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 + :vartype upgrade_mode: str or ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpgradeMode + :ivar role_profile: Describes the role profile for the cloud service. + :vartype role_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfile + :ivar os_profile: Describes the OS profile for the cloud service. + :vartype os_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceOsProfile + :ivar network_profile: Network Profile for the cloud service. + :vartype network_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceNetworkProfile + :ivar extension_profile: Describes a cloud service extension profile. + :vartype 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. @@ -1053,6 +1291,49 @@ def __init__( extension_profile: Optional["CloudServiceExtensionProfile"] = None, **kwargs ): + """ + :keyword 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. + :paramtype package_url: str + :keyword configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :paramtype configuration: str + :keyword 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. + :paramtype configuration_url: str + :keyword 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. + :paramtype start_cloud_service: bool + :keyword 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``. + :paramtype allow_model_override: bool + :keyword 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". + :paramtype upgrade_mode: str or ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpgradeMode + :keyword role_profile: Describes the role profile for the cloud service. + :paramtype role_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfile + :keyword os_profile: Describes the OS profile for the cloud service. + :paramtype os_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceOsProfile + :keyword network_profile: Network Profile for the cloud service. + :paramtype network_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceNetworkProfile + :keyword extension_profile: Describes a cloud service extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProfile + """ super(CloudServiceProperties, self).__init__(**kwargs) self.package_url = package_url self.configuration = configuration @@ -1081,10 +1362,10 @@ class CloudServiceRole(msrest.serialization.Model): :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 + :ivar sku: Describes the cloud service role sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku + :ivar properties: + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProperties """ _validation = { @@ -1110,6 +1391,12 @@ def __init__( properties: Optional["CloudServiceRoleProperties"] = None, **kwargs ): + """ + :keyword sku: Describes the cloud service role sku. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku + :keyword properties: + :paramtype properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProperties + """ super(CloudServiceRole, self).__init__(**kwargs) self.id = None self.name = None @@ -1124,10 +1411,10 @@ class CloudServiceRoleListResult(msrest.serialization.Model): 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 + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRole] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -1146,6 +1433,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRole] + :keyword next_link: + :paramtype next_link: str + """ super(CloudServiceRoleListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1154,8 +1447,8 @@ def __init__( 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] + :ivar roles: List of roles for the cloud service. + :vartype roles: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfileProperties] """ _attribute_map = { @@ -1168,6 +1461,11 @@ def __init__( roles: Optional[List["CloudServiceRoleProfileProperties"]] = None, **kwargs ): + """ + :keyword roles: List of roles for the cloud service. + :paramtype roles: + list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfileProperties] + """ super(CloudServiceRoleProfile, self).__init__(**kwargs) self.roles = roles @@ -1175,10 +1473,10 @@ def __init__( 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 + :ivar name: Resource name. + :vartype name: str + :ivar sku: Describes the cloud service role sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku """ _attribute_map = { @@ -1193,6 +1491,12 @@ def __init__( sku: Optional["CloudServiceRoleSku"] = None, **kwargs ): + """ + :keyword name: Resource name. + :paramtype name: str + :keyword sku: Describes the cloud service role sku. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku + """ super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) self.name = name self.sku = sku @@ -1219,6 +1523,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudServiceRoleProperties, self).__init__(**kwargs) self.unique_id = None @@ -1226,15 +1532,15 @@ def __init__( 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 + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of role instances in the cloud service. + :vartype capacity: long """ _attribute_map = { @@ -1251,6 +1557,17 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword 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. + :paramtype name: str + :keyword tier: Specifies the tier of the cloud service. Possible Values are :code:`
    `:code:`
    ` **Standard** :code:`
    `:code:`
    ` **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of role instances in the cloud service. + :paramtype capacity: long + """ super(CloudServiceRoleSku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -1260,8 +1577,8 @@ def __init__( class CloudServiceUpdate(msrest.serialization.Model): """CloudServiceUpdate. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1274,6 +1591,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(CloudServiceUpdate, self).__init__(**kwargs) self.tags = tags @@ -1281,10 +1602,10 @@ def __init__( 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 + :ivar source_vault: + :vartype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar secret_url: + :vartype secret_url: str """ _attribute_map = { @@ -1299,6 +1620,12 @@ def __init__( secret_url: Optional[str] = None, **kwargs ): + """ + :keyword source_vault: + :paramtype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword secret_url: + :paramtype secret_url: str + """ super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -1307,9 +1634,9 @@ def __init__( 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 + :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as a secret. - :type certificate_url: str + :vartype certificate_url: str """ _attribute_map = { @@ -1322,6 +1649,11 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword certificate_url: This is the URL of a certificate that has been uploaded to Key Vault + as a secret. + :paramtype certificate_url: str + """ super(CloudServiceVaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url @@ -1329,12 +1661,12 @@ def __init__( 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 + :ivar 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 + :vartype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: + :vartype vault_certificates: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultCertificate] """ @@ -1350,6 +1682,15 @@ def __init__( vault_certificates: Optional[List["CloudServiceVaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: + list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultCertificate] + """ super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -1376,6 +1717,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -1421,6 +1764,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -1437,44 +1782,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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 + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :ivar 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 + :vartype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :ivar 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 + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :ivar 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 + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype 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. @@ -1483,7 +1828,7 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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 @@ -1493,13 +1838,13 @@ class DataDisk(msrest.serialization.Model): 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 - :param delete_option: Specifies whether data disk should be deleted or detached upon VM + :vartype detach_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDetachOptionTypes + :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` The default value is set to **detach**. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes """ _validation = { @@ -1543,6 +1888,63 @@ def __init__( delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + :keyword 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". + :paramtype detach_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDetachOptionTypes + :keyword delete_option: Specifies whether data disk should be deleted or detached upon VM + deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** + If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` + The default value is set to **detach**. Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -1582,6 +1984,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -1599,29 +2003,29 @@ class DedicatedHost(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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 + :ivar 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 + :vartype 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. @@ -1672,6 +2076,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -1687,11 +2113,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -1706,6 +2132,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -1714,9 +2147,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1729,6 +2163,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1746,27 +2186,27 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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 + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1802,6 +2242,24 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1813,8 +2271,8 @@ def __init__( 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] + :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceViewWithName] """ _attribute_map = { @@ -1827,6 +2285,11 @@ def __init__( hosts: Optional[List["DedicatedHostInstanceViewWithName"]] = None, **kwargs ): + """ + :keyword hosts: List of instance view of the dedicated hosts under the dedicated host group. + :paramtype hosts: + list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceViewWithName] + """ super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) self.hosts = hosts @@ -1836,11 +2299,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1859,6 +2322,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1869,25 +2339,25 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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 + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1914,6 +2384,22 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1930,10 +2416,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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 available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _validation = { @@ -1953,6 +2440,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -1967,10 +2461,11 @@ class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): :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 available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] :ivar name: The name of the dedicated host. :vartype name: str """ @@ -1994,6 +2489,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceViewWithName, self).__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) self.name = None @@ -2003,11 +2505,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2026,6 +2528,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2036,24 +2545,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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 + :ivar 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 + :vartype 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. @@ -2092,6 +2601,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -2106,11 +2632,11 @@ def __init__( 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 + :ivar 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 + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnostics """ _attribute_map = { @@ -2123,6 +2649,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -2130,10 +2663,10 @@ def __init__( 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 + :ivar 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 + :vartype option: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskOptions + :ivar 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:`
    ` @@ -2141,7 +2674,7 @@ class DiffDiskSettings(msrest.serialization.Model): https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/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 + :vartype placement: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskPlacement """ _attribute_map = { @@ -2156,6 +2689,20 @@ def __init__( placement: Optional[Union[str, "DiffDiskPlacement"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskOptions + :keyword 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/azure/virtual-machines/windows/sizes and Linux VM at + https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a + cache disk. Possible values include: "CacheDisk", "ResourceDisk". + :paramtype placement: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskPlacement + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option self.placement = placement @@ -2164,9 +2711,9 @@ def __init__( 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", + :ivar 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 + :vartype vm_disk_type: str or ~azure.mgmt.compute.v2021_03_01.models.VmDiskTypes """ _attribute_map = { @@ -2179,6 +2726,11 @@ def __init__( vm_disk_type: Optional[Union[str, "VmDiskTypes"]] = None, **kwargs ): + """ + :keyword vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :paramtype vm_disk_type: str or ~azure.mgmt.compute.v2021_03_01.models.VmDiskTypes + """ super(DisallowedConfiguration, self).__init__(**kwargs) self.vm_disk_type = vm_disk_type @@ -2186,8 +2738,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2200,6 +2752,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -2207,8 +2763,8 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2221,19 +2777,23 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ 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 + :ivar 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 + :vartype disk_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -2250,6 +2810,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -2259,13 +2828,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -2282,6 +2852,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -2291,10 +2871,10 @@ def __init__( 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 + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -2309,6 +2889,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -2317,10 +2903,10 @@ def __init__( 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 + :ivar name: The name of the extension. + :vartype name: str + :ivar properties: Extension Properties. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProperties """ _attribute_map = { @@ -2335,6 +2921,12 @@ def __init__( properties: Optional["CloudServiceExtensionProperties"] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword properties: Extension Properties. + :paramtype properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProperties + """ super(Extension, self).__init__(**kwargs) self.name = name self.properties = properties @@ -2343,7 +2935,7 @@ def __init__( 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 + :ivar 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 @@ -2389,7 +2981,7 @@ class HardwareProfile(msrest.serialization.Model): "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 + :vartype vm_size: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -2402,6 +2994,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -2419,24 +3060,25 @@ class Image(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Image. + :vartype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype 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 + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes """ _validation = { @@ -2471,6 +3113,25 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Image. + :paramtype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location self.source_virtual_machine = source_virtual_machine @@ -2482,30 +3143,32 @@ def __init__( 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 + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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 + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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 + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :ivar 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 + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -2530,6 +3193,34 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ super(ImageDisk, self).__init__(**kwargs) self.snapshot = snapshot self.managed_disk = managed_disk @@ -2545,34 +3236,36 @@ class ImageDataDisk(ImageDisk): 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 + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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 + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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 + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :ivar 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 + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype lun: int """ _validation = { @@ -2603,6 +3296,38 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :keyword 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. + :paramtype lun: int + """ 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 @@ -2612,11 +3337,11 @@ class ImageListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2635,6 +3360,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2645,37 +3377,39 @@ class ImageOSDisk(ImageDisk): 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 + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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 + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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 + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :ivar 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 + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemStateTypes """ _validation = { @@ -2709,6 +3443,42 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemStateTypes + """ 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 @@ -2719,21 +3489,21 @@ class ImageReference(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype 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'. @@ -2763,6 +3533,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -2774,19 +3561,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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 + :vartype os_disk: ~azure.mgmt.compute.v2021_03_01.models.ImageOSDisk + :ivar 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. + :vartype data_disks: list[~azure.mgmt.compute.v2021_03_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -2803,6 +3590,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_03_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2021_03_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -2814,20 +3616,21 @@ class ImageUpdate(UpdateResource): 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 tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype 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 + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes """ _validation = { @@ -2851,6 +3654,21 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -2861,10 +3679,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -2879,6 +3697,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -2909,6 +3733,8 @@ def __init__( self, **kwargs ): + """ + """ super(InstanceSku, self).__init__(**kwargs) self.name = None self.tier = None @@ -2917,16 +3743,16 @@ def __init__( 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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -2947,6 +3773,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -2976,6 +3814,8 @@ def __init__( self, **kwargs ): + """ + """ super(InstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -2985,10 +3825,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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 + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource """ _validation = { @@ -3008,6 +3848,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -3018,10 +3864,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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 + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource """ _validation = { @@ -3041,6 +3887,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -3116,6 +3968,8 @@ def __init__( self, **kwargs ): + """ + """ super(LastPatchInstallationSummary, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -3133,19 +3987,19 @@ def __init__( 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 `_. - :param disable_password_authentication: Specifies whether password authentication should be + :ivar 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 + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2021_03_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. - :type patch_settings: ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchSettings + :vartype patch_settings: ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchSettings """ _attribute_map = { @@ -3164,6 +4018,21 @@ def __init__( patch_settings: Optional["LinuxPatchSettings"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2021_03_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :paramtype patch_settings: ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchSettings + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -3174,19 +4043,19 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Linux. - :type classifications_to_include: list[str or + :vartype 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: + :ivar 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: + :vartype package_name_masks_to_include: list[str] + :ivar 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 + :vartype package_name_masks_to_exclude: list[str] + :ivar maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest Patching in Linux. - :type maintenance_run_id: str + :vartype maintenance_run_id: str """ _attribute_map = { @@ -3205,6 +4074,21 @@ def __init__( maintenance_run_id: Optional[str] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Linux. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchClassificationLinux] + :keyword package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_include: list[str] + :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_exclude: list[str] + :keyword maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :paramtype maintenance_run_id: str + """ super(LinuxParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.package_name_masks_to_include = package_name_masks_to_include @@ -3215,21 +4099,22 @@ def __init__( 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 or virtual + :ivar patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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 - :param assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + :vartype patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.LinuxVMGuestPatchMode + :ivar assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. Possible values include: "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchAssessmentMode + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchAssessmentMode """ _attribute_map = { @@ -3244,6 +4129,24 @@ def __init__( assessment_mode: Optional[Union[str, "LinuxPatchAssessmentMode"]] = None, **kwargs ): + """ + :keyword patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.LinuxVMGuestPatchMode + :keyword assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` + **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchAssessmentMode + """ super(LinuxPatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode self.assessment_mode = assessment_mode @@ -3254,11 +4157,11 @@ class ListUsagesResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3277,6 +4180,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3287,12 +4197,12 @@ class LoadBalancerConfiguration(msrest.serialization.Model): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the Load balancer. + :vartype name: str + :ivar properties: Required. Properties of the load balancer configuration. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfigurationProperties """ _validation = { @@ -3314,6 +4224,15 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the Load balancer. + :paramtype name: str + :keyword properties: Required. Properties of the load balancer configuration. + :paramtype properties: + ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfigurationProperties + """ super(LoadBalancerConfiguration, self).__init__(**kwargs) self.id = id self.name = name @@ -3325,10 +4244,10 @@ class LoadBalancerConfigurationProperties(msrest.serialization.Model): 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 + :ivar 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: + :vartype frontend_ip_configurations: list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfiguration] """ @@ -3346,6 +4265,13 @@ def __init__( frontend_ip_configurations: List["LoadBalancerFrontendIPConfiguration"], **kwargs ): + """ + :keyword 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. + :paramtype frontend_ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfiguration] + """ super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) self.frontend_ip_configurations = frontend_ip_configurations @@ -3355,11 +4281,11 @@ class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): 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 + :ivar 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: + :vartype name: str + :ivar properties: Required. Properties of load balancer frontend ip configuration. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfigurationProperties """ @@ -3380,6 +4306,14 @@ def __init__( properties: "LoadBalancerFrontendIPConfigurationProperties", **kwargs ): + """ + :keyword 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. + :paramtype name: str + :keyword properties: Required. Properties of load balancer frontend ip configuration. + :paramtype properties: + ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfigurationProperties + """ super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) self.name = name self.properties = properties @@ -3388,12 +4322,12 @@ def __init__( 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 + :ivar public_ip_address: The reference to the public ip address resource. + :vartype public_ip_address: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar subnet: The reference to the virtual network subnet resource. + :vartype subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar private_ip_address: The virtual network private IP address of the IP configuration. + :vartype private_ip_address: str """ _attribute_map = { @@ -3410,6 +4344,14 @@ def __init__( private_ip_address: Optional[str] = None, **kwargs ): + """ + :keyword public_ip_address: The reference to the public ip address resource. + :paramtype public_ip_address: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword subnet: The reference to the virtual network subnet resource. + :paramtype subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword private_ip_address: The virtual network private IP address of the IP configuration. + :paramtype private_ip_address: str + """ super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) self.public_ip_address = public_ip_address self.subnet = subnet @@ -3421,23 +4363,23 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -3470,6 +4412,25 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -3502,6 +4463,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -3527,6 +4490,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -3534,23 +4499,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype 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 + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -3575,6 +4540,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -3588,17 +4572,19 @@ def __init__( 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. 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. Possible values include: + :ivar id: Resource Id. + :vartype id: str + :ivar storage_account_type: 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. 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 + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :ivar 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 + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -3615,6 +4601,21 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword storage_account_type: 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. Possible values include: + "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -3623,14 +4624,14 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions """ _attribute_map = { @@ -3647,6 +4648,16 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary self.delete_option = delete_option @@ -3655,17 +4666,17 @@ def __init__( class NetworkProfile(msrest.serialization.Model): """Specifies the network interfaces or the networking configuration of the virtual machine. - :param network_interfaces: Specifies the list of resource Ids for the network interfaces + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2021_03_01.models.NetworkInterfaceReference] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion - :param network_interface_configurations: Specifies the networking configurations that will be + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion + :ivar network_interface_configurations: Specifies the networking configurations that will be used to create the virtual machine networking resources. - :type network_interface_configurations: + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceConfiguration] """ @@ -3683,6 +4694,20 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineNetworkInterfaceConfiguration"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2021_03_01.models.NetworkInterfaceReference] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations. Possible values include: + "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion + :keyword network_interface_configurations: Specifies the networking configurations that will be + used to create the virtual machine networking resources. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceConfiguration] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces self.network_api_version = network_api_version @@ -3694,12 +4719,12 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_name: Required. The name of the service. Possible values include: + :ivar 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", + :vartype service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames + :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". - :type action: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceStateAction + :vartype action: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceStateAction """ _validation = { @@ -3719,6 +4744,16 @@ def __init__( action: Union[str, "OrchestrationServiceStateAction"], **kwargs ): + """ + :keyword service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :paramtype service_name: str or + ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames + :keyword action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :paramtype action: str or + ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceStateAction + """ super(OrchestrationServiceStateInput, self).__init__(**kwargs) self.service_name = service_name self.action = action @@ -3751,6 +4786,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrchestrationServiceSummary, self).__init__(**kwargs) self.service_name = None self.service_state = None @@ -3761,56 +4798,56 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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. + :vartype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :ivar 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 + :vartype encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :ivar 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 + :vartype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :ivar 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 + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :ivar 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 + :vartype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :ivar 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 delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The default value is set to **detach**. For an ephemeral OS Disk, the default value is set to **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes """ _validation = { @@ -3849,6 +4886,58 @@ def __init__( delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :keyword delete_option: Specifies whether OS Disk should be deleted or detached upon VM + deletion. :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If + this value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The + default value is set to **detach**. For an ephemeral OS Disk, the default value is set to + **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values + include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDeleteOptionTypes + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -3869,9 +4958,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar 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 + :vartype operating_system: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes """ _validation = { @@ -3888,6 +4977,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -3905,8 +4999,8 @@ class OSFamily(msrest.serialization.Model): :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 + :ivar properties: OS family properties. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.OSFamilyProperties """ _validation = { @@ -3930,6 +5024,10 @@ def __init__( properties: Optional["OSFamilyProperties"] = None, **kwargs ): + """ + :keyword properties: OS family properties. + :paramtype properties: ~azure.mgmt.compute.v2021_03_01.models.OSFamilyProperties + """ super(OSFamily, self).__init__(**kwargs) self.id = None self.name = None @@ -3943,10 +5041,10 @@ class OSFamilyListResult(msrest.serialization.Model): 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 + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.OSFamily] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -3965,6 +5063,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.OSFamily] + :keyword next_link: + :paramtype next_link: str + """ super(OSFamilyListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3999,6 +5103,8 @@ def __init__( self, **kwargs ): + """ + """ super(OSFamilyProperties, self).__init__(**kwargs) self.name = None self.label = None @@ -4008,25 +5114,24 @@ def __init__( 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. + :ivar 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. - :type admin_username: str - :param admin_password: Specifies the password of the administrator account. + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -4040,8 +5145,8 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 @@ -4051,30 +5156,30 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype custom_data: str + :ivar 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 + :vartype windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :ivar 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 `_. - :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. To install certificates on a virtual machine it is recommended to use the `Azure Key - Vault virtual machine extension for Linux + :vartype linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + To install certificates on a virtual machine it is recommended to use the `Azure Key Vault + virtual machine extension for Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar 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 + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -4103,6 +5208,75 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. To install certificates on a virtual machine it is recommended to use the `Azure Key + Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword 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.**. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -4128,8 +5302,8 @@ class OSVersion(msrest.serialization.Model): :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 properties: OS version properties. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.OSVersionProperties """ _validation = { @@ -4153,6 +5327,10 @@ def __init__( properties: Optional["OSVersionProperties"] = None, **kwargs ): + """ + :keyword properties: OS version properties. + :paramtype properties: ~azure.mgmt.compute.v2021_03_01.models.OSVersionProperties + """ super(OSVersion, self).__init__(**kwargs) self.id = None self.name = None @@ -4166,10 +5344,10 @@ class OSVersionListResult(msrest.serialization.Model): 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 + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.OSVersion] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -4188,6 +5366,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.OSVersion] + :keyword next_link: + :paramtype next_link: str + """ super(OSVersionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4234,6 +5418,8 @@ def __init__( self, **kwargs ): + """ + """ super(OSVersionProperties, self).__init__(**kwargs) self.family = None self.family_label = None @@ -4276,6 +5462,8 @@ def __init__( self, **kwargs ): + """ + """ super(OSVersionPropertiesBase, self).__init__(**kwargs) self.version = None self.label = None @@ -4328,6 +5516,8 @@ def __init__( self, **kwargs ): + """ + """ super(PatchInstallationDetail, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -4340,7 +5530,7 @@ def __init__( 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 or virtual + :ivar patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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 @@ -4351,18 +5541,19 @@ class PatchSettings(msrest.serialization.Model): **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 + :vartype patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.WindowsVMGuestPatchMode + :ivar 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 - :param assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual + :vartype enable_hotpatching: bool + :ivar assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. Possible values include: "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_03_01.models.WindowsPatchAssessmentMode + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2021_03_01.models.WindowsPatchAssessmentMode """ _attribute_map = { @@ -4379,6 +5570,32 @@ def __init__( assessment_mode: Optional[Union[str, "WindowsPatchAssessmentMode"]] = None, **kwargs ): + """ + :keyword patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.WindowsVMGuestPatchMode + :keyword 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'. + :paramtype enable_hotpatching: bool + :keyword assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual + machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` + **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2021_03_01.models.WindowsPatchAssessmentMode + """ super(PatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode self.enable_hotpatching = enable_hotpatching @@ -4388,15 +5605,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -4415,6 +5632,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4435,15 +5663,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype 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. @@ -4457,8 +5685,8 @@ class ProximityPlacementGroup(Resource): 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 + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus """ _validation = { @@ -4493,6 +5721,20 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -4506,10 +5748,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -4528,6 +5770,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4536,8 +5784,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -4550,6 +5798,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -4582,6 +5834,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -4591,10 +5845,10 @@ def __init__( class PublicIPAddressSku(msrest.serialization.Model): """Describes the public IP Sku. - :param name: Specify public IP sku name. Possible values include: "Basic", "Standard". - :type name: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuName - :param tier: Specify public IP sku tier. Possible values include: "Regional", "Global". - :type tier: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuTier + :ivar name: Specify public IP sku name. Possible values include: "Basic", "Standard". + :vartype name: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuName + :ivar tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :vartype tier: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuTier """ _attribute_map = { @@ -4609,6 +5863,12 @@ def __init__( tier: Optional[Union[str, "PublicIPAddressSkuTier"]] = None, **kwargs ): + """ + :keyword name: Specify public IP sku name. Possible values include: "Basic", "Standard". + :paramtype name: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuName + :keyword tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :paramtype tier: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSkuTier + """ super(PublicIPAddressSku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -4619,13 +5879,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -4648,6 +5908,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -4680,6 +5949,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -4690,26 +5961,26 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool + :ivar 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 + :vartype interval_length: str or ~azure.mgmt.compute.v2021_03_01.models.IntervalInMins """ _validation = { @@ -4745,6 +6016,28 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2021_03_01.models.IntervalInMins + """ 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 @@ -4762,8 +6055,8 @@ class ResourceInstanceViewStatus(msrest.serialization.Model): :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 + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes """ _validation = { @@ -4787,6 +6080,10 @@ def __init__( level: Optional[Union[str, "StatusLevelTypes"]] = None, **kwargs ): + """ + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + """ super(ResourceInstanceViewStatus, self).__init__(**kwargs) self.code = None self.display_status = None @@ -4806,9 +6103,9 @@ class RestorePoint(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param exclude_disks: List of disk resource ids that the customer wishes to exclude from the + :ivar exclude_disks: List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. - :type exclude_disks: list[~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference] + :vartype exclude_disks: list[~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference] :ivar source_metadata: Gets the details of the VM captured at the time of the restore point creation. :vartype source_metadata: ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceMetadata @@ -4818,10 +6115,8 @@ class RestorePoint(ProxyResource): https://aka.ms/RestorePoints for more details. Possible values include: "CrashConsistent", "FileSystemConsistent", "ApplicationConsistent". :vartype consistency_mode: str or ~azure.mgmt.compute.v2021_03_01.models.ConsistencyModeTypes - :ivar provisioning_details: Gets the provisioning details set by the server during Create - restore point operation. - :vartype provisioning_details: - ~azure.mgmt.compute.v2021_03_01.models.RestorePointProvisioningDetails + :ivar time_created: Gets the creation time of the restore point. + :vartype time_created: ~datetime.datetime """ _validation = { @@ -4831,7 +6126,6 @@ class RestorePoint(ProxyResource): 'source_metadata': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'consistency_mode': {'readonly': True}, - 'provisioning_details': {'readonly': True}, } _attribute_map = { @@ -4842,21 +6136,29 @@ class RestorePoint(ProxyResource): 'source_metadata': {'key': 'properties.sourceMetadata', 'type': 'RestorePointSourceMetadata'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'consistency_mode': {'key': 'properties.consistencyMode', 'type': 'str'}, - 'provisioning_details': {'key': 'properties.provisioningDetails', 'type': 'RestorePointProvisioningDetails'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, } def __init__( self, *, exclude_disks: Optional[List["ApiEntityReference"]] = None, + time_created: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword exclude_disks: List of disk resource ids that the customer wishes to exclude from the + restore point. If no disks are specified, all disks will be included. + :paramtype exclude_disks: list[~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference] + :keyword time_created: Gets the creation time of the restore point. + :paramtype time_created: ~datetime.datetime + """ super(RestorePoint, self).__init__(**kwargs) self.exclude_disks = exclude_disks self.source_metadata = None self.provisioning_state = None self.consistency_mode = None - self.provisioning_details = None + self.time_created = time_created class RestorePointCollection(Resource): @@ -4872,13 +6174,13 @@ class RestorePointCollection(Resource): :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 properties of the source resource that this restore point collection is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The properties of the source resource that this restore point collection is created from. - :type source: ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties + :vartype source: ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties :ivar provisioning_state: The provisioning state of the restore point collection. :vartype provisioning_state: str :ivar restore_point_collection_id: The unique id of the restore point collection. @@ -4918,6 +6220,16 @@ def __init__( source: Optional["RestorePointCollectionSourceProperties"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The properties of the source resource that this restore point collection is + created from. + :paramtype source: + ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties + """ super(RestorePointCollection, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.provisioning_state = None @@ -4928,11 +6240,11 @@ def __init__( class RestorePointCollectionListResult(msrest.serialization.Model): """The List restore point collection operation response. - :param value: Gets the list of restore point collections. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollection] - :param next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + :ivar value: Gets the list of restore point collections. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollection] + :ivar next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() with this to fetch the next page of RestorePointCollections. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -4947,6 +6259,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets the list of restore point collections. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollection] + :keyword next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + with this to fetch the next page of RestorePointCollections. + :paramtype next_link: str + """ super(RestorePointCollectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4959,8 +6278,8 @@ class RestorePointCollectionSourceProperties(msrest.serialization.Model): :ivar location: Location of the source resource used to create this restore point collection. :vartype location: str - :param id: Resource Id of the source resource used to create this restore point collection. - :type id: str + :ivar id: Resource Id of the source resource used to create this restore point collection. + :vartype id: str """ _validation = { @@ -4978,6 +6297,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id of the source resource used to create this restore point collection. + :paramtype id: str + """ super(RestorePointCollectionSourceProperties, self).__init__(**kwargs) self.location = None self.id = id @@ -4988,11 +6311,11 @@ class RestorePointCollectionUpdate(UpdateResource): 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 properties of the source resource that this restore point collection is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The properties of the source resource that this restore point collection is created from. - :type source: ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties + :vartype source: ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties :ivar provisioning_state: The provisioning state of the restore point collection. :vartype provisioning_state: str :ivar restore_point_collection_id: The unique id of the restore point collection. @@ -5023,6 +6346,14 @@ def __init__( source: Optional["RestorePointCollectionSourceProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The properties of the source resource that this restore point collection is + created from. + :paramtype source: + ~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionSourceProperties + """ super(RestorePointCollectionUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.provisioning_state = None @@ -5030,63 +6361,26 @@ def __init__( self.restore_points = None -class RestorePointProvisioningDetails(msrest.serialization.Model): - """Restore Point Provisioning details. - - :param creation_time: Gets the creation time of the restore point. - :type creation_time: ~datetime.datetime - :param total_used_size_in_bytes: Gets the total size of the data in all the disks which are - part of the restore point. - :type total_used_size_in_bytes: long - :param status_code: Gets the status of the Create restore point operation. - :type status_code: int - :param status_message: Gets the status message of the Create restore point operation. - :type status_message: str - """ - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'total_used_size_in_bytes': {'key': 'totalUsedSizeInBytes', 'type': 'long'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - } - - def __init__( - self, - *, - creation_time: Optional[datetime.datetime] = None, - total_used_size_in_bytes: Optional[int] = None, - status_code: Optional[int] = None, - status_message: Optional[str] = None, - **kwargs - ): - super(RestorePointProvisioningDetails, self).__init__(**kwargs) - self.creation_time = creation_time - self.total_used_size_in_bytes = total_used_size_in_bytes - self.status_code = status_code - self.status_message = status_message - - class RestorePointSourceMetadata(msrest.serialization.Model): """Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point creation. - :param hardware_profile: Gets the hardware profile. - :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile - :param storage_profile: Gets the storage profile. - :type storage_profile: + :ivar hardware_profile: Gets the hardware profile. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :ivar storage_profile: Gets the storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMStorageProfile - :param os_profile: Gets the OS profile. - :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile - :param diagnostics_profile: Gets the diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile - :param license_type: Gets the license type, which is for bring your own license scenario. - :type license_type: str - :param vm_id: Gets the virtual machine unique id. - :type vm_id: str - :param security_profile: Gets the security profile. - :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile - :param location: Location of the VM from which the restore point was created. - :type location: str + :ivar os_profile: Gets the OS profile. + :vartype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :ivar diagnostics_profile: Gets the diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :ivar license_type: Gets the license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar vm_id: Gets the virtual machine unique id. + :vartype vm_id: str + :ivar security_profile: Gets the security profile. + :vartype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :ivar location: Location of the VM from which the restore point was created. + :vartype location: str """ _attribute_map = { @@ -5113,6 +6407,25 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword hardware_profile: Gets the hardware profile. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :keyword storage_profile: Gets the storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMStorageProfile + :keyword os_profile: Gets the OS profile. + :paramtype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :keyword diagnostics_profile: Gets the diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :keyword license_type: Gets the license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword vm_id: Gets the virtual machine unique id. + :paramtype vm_id: str + :keyword security_profile: Gets the security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :keyword location: Location of the VM from which the restore point was created. + :paramtype location: str + """ super(RestorePointSourceMetadata, self).__init__(**kwargs) self.hardware_profile = hardware_profile self.storage_profile = storage_profile @@ -5127,20 +6440,19 @@ def __init__( class RestorePointSourceVMDataDisk(msrest.serialization.Model): """Describes a data disk. - :param lun: Gets the logical unit number. - :type lun: int - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes - :param disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired + :ivar lun: Gets the logical unit number. + :vartype lun: int + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference """ _attribute_map = { @@ -5163,6 +6475,22 @@ def __init__( disk_restore_point: Optional["ApiEntityReference"] = None, **kwargs ): + """ + :keyword lun: Gets the logical unit number. + :paramtype lun: int + :keyword name: Gets the disk name. + :paramtype name: str + :keyword caching: Gets the caching type. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new + desired size for existing OS and Data disks. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + """ super(RestorePointSourceVMDataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -5175,21 +6503,20 @@ def __init__( class RestorePointSourceVMOSDisk(msrest.serialization.Model): """Describes an Operating System disk. - :param os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemType - :param encryption_settings: Gets the disk encryption settings. - :type encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes - :param disk_size_gb: Gets the disk size in GB. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :ivar os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemType + :ivar encryption_settings: Gets the disk encryption settings. + :vartype encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar disk_size_gb: Gets the disk size in GB. + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference """ _attribute_map = { @@ -5214,6 +6541,23 @@ def __init__( disk_restore_point: Optional["ApiEntityReference"] = None, **kwargs ): + """ + :keyword os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemType + :keyword encryption_settings: Gets the disk encryption settings. + :paramtype encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings + :keyword name: Gets the disk name. + :paramtype name: str + :keyword caching: Gets the caching type. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword disk_size_gb: Gets the disk size in GB. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + """ super(RestorePointSourceVMOSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -5227,11 +6571,11 @@ def __init__( class RestorePointSourceVMStorageProfile(msrest.serialization.Model): """Describes the storage profile. - :param os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. - :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMOSDisk - :param data_disks: Gets the data disks of the VM captured at the time of the restore point + :ivar os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. + :vartype os_disk: ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMOSDisk + :ivar data_disks: Gets the data disks of the VM captured at the time of the restore point creation. - :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMDataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMDataDisk] """ _attribute_map = { @@ -5246,6 +6590,15 @@ def __init__( data_disks: Optional[List["RestorePointSourceVMDataDisk"]] = None, **kwargs ): + """ + :keyword os_disk: Gets the OS disk of the VM captured at the time of the restore point + creation. + :paramtype os_disk: ~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMOSDisk + :keyword data_disks: Gets the data disks of the VM captured at the time of the restore point + creation. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_03_01.models.RestorePointSourceVMDataDisk] + """ super(RestorePointSourceVMStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -5276,6 +6629,8 @@ def __init__( self, **kwargs ): + """ + """ super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -5296,10 +6651,10 @@ class RoleInstance(msrest.serialization.Model): :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 + :ivar sku: + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.InstanceSku + :ivar properties: + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceProperties """ _validation = { @@ -5327,6 +6682,12 @@ def __init__( properties: Optional["RoleInstanceProperties"] = None, **kwargs ): + """ + :keyword sku: + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.InstanceSku + :keyword properties: + :paramtype properties: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceProperties + """ super(RoleInstance, self).__init__(**kwargs) self.id = None self.name = None @@ -5342,10 +6703,10 @@ class RoleInstanceListResult(msrest.serialization.Model): 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 + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.RoleInstance] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -5364,6 +6725,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.RoleInstance] + :keyword next_link: + :paramtype next_link: str + """ super(RoleInstanceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5391,6 +6758,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleInstanceNetworkProfile, self).__init__(**kwargs) self.network_interfaces = None @@ -5398,10 +6767,10 @@ def __init__( 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 + :ivar network_profile: Describes the network profile for the role instance. + :vartype network_profile: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceNetworkProfile + :ivar instance_view: The instance view of the role instance. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceView """ _attribute_map = { @@ -5416,6 +6785,12 @@ def __init__( instance_view: Optional["RoleInstanceView"] = None, **kwargs ): + """ + :keyword network_profile: Describes the network profile for the role instance. + :paramtype network_profile: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceNetworkProfile + :keyword instance_view: The instance view of the role instance. + :paramtype instance_view: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceView + """ super(RoleInstanceProperties, self).__init__(**kwargs) self.network_profile = network_profile self.instance_view = instance_view @@ -5426,9 +6801,9 @@ class RoleInstances(msrest.serialization.Model): 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 + :ivar 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] + :vartype role_instances: list[str] """ _validation = { @@ -5445,6 +6820,11 @@ def __init__( role_instances: List[str], **kwargs ): + """ + :keyword role_instances: Required. List of cloud service role instance names. Value of '*' will + signify all role instances of the cloud service. + :paramtype role_instances: list[str] + """ super(RoleInstances, self).__init__(**kwargs) self.role_instances = role_instances @@ -5484,6 +6864,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleInstanceView, self).__init__(**kwargs) self.platform_update_domain = None self.platform_fault_domain = None @@ -5521,6 +6903,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -5530,33 +6914,33 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str + :ivar 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 + :vartype enable_cross_zone_upgrade: bool + :ivar prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before any + healthy instances. + :vartype prioritize_unhealthy_instances: bool """ _validation = { @@ -5585,6 +6969,35 @@ def __init__( prioritize_unhealthy_instances: Optional[bool] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + :keyword 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. + :paramtype enable_cross_zone_upgrade: bool + :keyword prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before + any healthy instances. + :paramtype prioritize_unhealthy_instances: bool + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -5628,6 +7041,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -5670,6 +7085,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -5690,10 +7107,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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. @@ -5735,6 +7152,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -5747,17 +7170,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar 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 + :vartype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -5786,6 +7209,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -5799,21 +7235,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar 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] + :vartype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandParameterDefinition] """ _validation = { @@ -5847,6 +7283,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2021_03_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -5857,13 +7311,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] """ _validation = { @@ -5884,6 +7338,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -5895,10 +7358,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -5918,6 +7381,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -5928,11 +7397,11 @@ class RunCommandListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -5951,6 +7420,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5961,14 +7437,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -5992,6 +7468,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -6002,8 +7488,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6016,6 +7502,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -6023,7 +7513,7 @@ def __init__( 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. + :ivar 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 @@ -6037,7 +7527,7 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetScaleInRules] """ @@ -6051,6 +7541,24 @@ def __init__( rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetScaleInRules] + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules @@ -6058,9 +7566,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2021_03_01.models.TerminateNotificationProfile """ @@ -6074,6 +7582,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2021_03_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -6081,20 +7595,20 @@ def __init__( class SecurityProfile(msrest.serialization.Model): """Specifies the Security profile settings for the virtual machine or virtual machine scale set. - :param uefi_settings: Specifies the security settings like secure boot and vTPM used while + :ivar 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. + :vartype uefi_settings: ~azure.mgmt.compute.v2021_03_01.models.UefiSettings + :ivar 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 - :param security_type: Specifies the SecurityType of the virtual machine. It is set as + :vartype 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. Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_03_01.models.SecurityTypes + :vartype security_type: str or ~azure.mgmt.compute.v2021_03_01.models.SecurityTypes """ _attribute_map = { @@ -6111,6 +7625,22 @@ def __init__( security_type: Optional[Union[str, "SecurityTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype uefi_settings: ~azure.mgmt.compute.v2021_03_01.models.UefiSettings + :keyword 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. + :paramtype encryption_at_host: bool + :keyword 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. Possible values include: + "TrustedLaunch". + :paramtype security_type: str or ~azure.mgmt.compute.v2021_03_01.models.SecurityTypes + """ super(SecurityProfile, self).__init__(**kwargs) self.uefi_settings = uefi_settings self.encryption_at_host = encryption_at_host @@ -6120,14 +7650,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -6144,6 +7674,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -6153,8 +7693,8 @@ def __init__( 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] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKey] """ _attribute_map = { @@ -6167,6 +7707,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -6174,15 +7718,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - :type key_data: str + :vartype key_data: str """ _attribute_map = { @@ -6197,6 +7741,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -6207,16 +7762,16 @@ class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): 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 + :ivar 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 + :vartype private_key: str + :ivar 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 + :vartype public_key: str + :ivar id: Required. The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - :type id: str + :vartype id: str """ _validation = { @@ -6239,6 +7794,18 @@ def __init__( id: str, **kwargs ): + """ + :keyword 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. + :paramtype private_key: str + :keyword 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. + :paramtype public_key: str + :keyword id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :paramtype id: str + """ super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) self.private_key = private_key self.public_key = public_key @@ -6258,15 +7825,15 @@ class SshPublicKeyResource(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _validation = { @@ -6293,6 +7860,17 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyResource, self).__init__(location=location, tags=tags, **kwargs) self.public_key = public_key @@ -6302,11 +7880,11 @@ class SshPublicKeysGroupListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of SSH public keys. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6325,6 +7903,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of SSH public keys. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource] + :keyword 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. + :paramtype next_link: str + """ super(SshPublicKeysGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6333,13 +7918,13 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _attribute_map = { @@ -6354,6 +7939,15 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyUpdateResource, self).__init__(tags=tags, **kwargs) self.public_key = public_key @@ -6383,6 +7977,8 @@ def __init__( self, **kwargs ): + """ + """ super(StatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -6391,21 +7987,21 @@ def __init__( 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 + :ivar 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 + :vartype image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :ivar 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 + :vartype os_disk: ~azure.mgmt.compute.v2021_03_01.models.OSDisk + :ivar 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] + :vartype data_disks: list[~azure.mgmt.compute.v2021_03_01.models.DataDisk] """ _attribute_map = { @@ -6422,6 +8018,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_03_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2021_03_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -6449,6 +8062,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -6456,11 +8071,11 @@ def __init__( class SubResourceWithColocationStatus(SubResource): """SubResourceWithColocationStatus. - :param id: Resource Id. - :type id: str - :param colocation_status: Describes colocation status of a resource in the Proximity Placement + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + :vartype colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus """ _attribute_map = { @@ -6475,6 +8090,13 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword colocation_status: Describes colocation status of a resource in the Proximity + Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) self.colocation_status = colocation_status @@ -6482,13 +8104,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -6503,6 +8125,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -6513,23 +8144,23 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -6562,18 +8193,37 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ 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 + :ivar 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. + :vartype secure_boot_enabled: bool + :ivar 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 + :vartype v_tpm_enabled: bool """ _attribute_map = { @@ -6588,6 +8238,14 @@ def __init__( v_tpm_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Specifies whether vTPM should be enabled on the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype v_tpm_enabled: bool + """ super(UefiSettings, self).__init__(**kwargs) self.secure_boot_enabled = secure_boot_enabled self.v_tpm_enabled = v_tpm_enabled @@ -6618,6 +8276,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDomain, self).__init__(**kwargs) self.id = None self.name = None @@ -6628,10 +8288,10 @@ class UpdateDomainListResult(msrest.serialization.Model): 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 + :ivar value: Required. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.UpdateDomain] + :ivar next_link: + :vartype next_link: str """ _validation = { @@ -6650,6 +8310,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.UpdateDomain] + :keyword next_link: + :paramtype next_link: str + """ super(UpdateDomainListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6685,6 +8351,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -6733,6 +8401,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -6772,6 +8442,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -6781,19 +8453,19 @@ def __init__( 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 + :vartype mode: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeMode + :ivar 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 + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradePolicy """ @@ -6811,6 +8483,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -6826,12 +8514,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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 + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2021_03_01.models.UsageName """ _validation = { @@ -6858,6 +8546,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2021_03_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -6867,10 +8563,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -6885,6 +8581,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -6915,6 +8617,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6923,7 +8627,7 @@ def __init__( 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 + :ivar 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 @@ -6934,14 +8638,14 @@ class VaultCertificate(msrest.serialization.Model): Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type certificate_url: str - :param certificate_store: For Windows VMs, specifies the certificate store on the Virtual + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -6956,6 +8660,27 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `} :code:`
    ` To install certificates on a + virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for + Linux `_ or the + `Azure Key Vault virtual machine extension for Windows + `_. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -6964,12 +8689,12 @@ def __init__( 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 + :ivar 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 + :vartype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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] + :vartype vault_certificates: list[~azure.mgmt.compute.v2021_03_01.models.VaultCertificate] """ _attribute_map = { @@ -6984,6 +8709,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2021_03_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -6992,8 +8725,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -7006,6 +8739,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -7023,43 +8760,43 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype 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 + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :ivar 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 + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :ivar 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 + :vartype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :ivar 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. + :vartype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :ivar 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 + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -7072,46 +8809,45 @@ class VirtualMachine(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 + :vartype availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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 + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype 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. + :ivar 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. + :vartype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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 + :vartype 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 + :ivar 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: @@ -7121,16 +8857,16 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -7138,12 +8874,13 @@ class VirtualMachine(Resource): 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 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 + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :ivar 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 + :vartype user_data: str """ _validation = { @@ -7224,6 +8961,122 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -7258,13 +9111,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype 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] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -7281,6 +9134,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -7346,6 +9208,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -7362,13 +9226,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -7391,6 +9255,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -7402,8 +9275,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -7435,6 +9308,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -7455,36 +9332,37 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -7529,6 +9407,37 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -7545,12 +9454,12 @@ def __init__( 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 + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus """ _attribute_map = { @@ -7567,6 +9476,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -7586,23 +9503,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -7637,6 +9554,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -7648,16 +9584,16 @@ def __init__( 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] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -7678,6 +9614,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -7689,8 +9637,8 @@ def __init__( 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] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -7703,6 +9651,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -7710,29 +9662,29 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -7761,6 +9713,31 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -7793,6 +9770,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -7808,15 +9787,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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 + :vartype type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_03_01.models.UserAssignedIdentitiesValue] """ @@ -7839,6 +9818,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_03_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -7851,18 +9842,18 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation """ _validation = { @@ -7888,6 +9879,20 @@ def __init__( extended_location: Optional["ExtendedLocation"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -7900,36 +9905,37 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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 + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :ivar 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: + :vartype plan: ~azure.mgmt.compute.v2021_03_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2021_03_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2021_03_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar 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 + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + :ivar 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] + :vartype disallowed: ~azure.mgmt.compute.v2021_03_01.models.DisallowedConfiguration + :ivar features: + :vartype features: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageFeature] """ _validation = { @@ -7969,6 +9975,40 @@ def __init__( features: Optional[List["VirtualMachineImageFeature"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2021_03_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2021_03_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2021_03_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + :keyword disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :paramtype disallowed: ~azure.mgmt.compute.v2021_03_01.models.DisallowedConfiguration + :keyword features: + :paramtype features: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageFeature] + """ 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 @@ -7982,10 +10022,10 @@ def __init__( 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 + :ivar name: The name of the feature. + :vartype name: str + :ivar value: The corresponding value for the feature. + :vartype value: str """ _attribute_map = { @@ -8000,6 +10040,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the feature. + :paramtype name: str + :keyword value: The corresponding value for the feature. + :paramtype value: str + """ super(VirtualMachineImageFeature, self).__init__(**kwargs) self.name = name self.value = value @@ -8010,18 +10056,19 @@ class VirtualMachineInstallPatchesParameters(msrest.serialization.Model): 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 + :ivar 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 + :vartype maximum_duration: str + :ivar 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 + :vartype reboot_setting: str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchRebootSetting + :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the API. - :type linux_parameters: ~azure.mgmt.compute.v2021_03_01.models.LinuxParameters + :vartype windows_parameters: ~azure.mgmt.compute.v2021_03_01.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :vartype linux_parameters: ~azure.mgmt.compute.v2021_03_01.models.LinuxParameters """ _validation = { @@ -8045,6 +10092,21 @@ def __init__( linux_parameters: Optional["LinuxParameters"] = None, **kwargs ): + """ + :keyword 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). + :paramtype maximum_duration: str + :keyword reboot_setting: Required. Defines when it is acceptable to reboot a VM during a + software update operation. Possible values include: "IfRequired", "Never", "Always". + :paramtype reboot_setting: str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchRebootSetting + :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :paramtype windows_parameters: ~azure.mgmt.compute.v2021_03_01.models.WindowsParameters + :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :paramtype linux_parameters: ~azure.mgmt.compute.v2021_03_01.models.LinuxParameters + """ super(VirtualMachineInstallPatchesParameters, self).__init__(**kwargs) self.maximum_duration = maximum_duration self.reboot_setting = reboot_setting @@ -8129,6 +10191,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineInstallPatchesResult, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -8149,47 +10213,47 @@ class VirtualMachineInstanceView(msrest.serialization.Model): 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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype 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: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype 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 + :ivar 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 + :vartype 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 + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar patch_status: [Preview Feature] The status of virtual machine patch operations. + :vartype patch_status: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePatchStatus """ _validation = { @@ -8235,6 +10299,43 @@ def __init__( patch_status: Optional["VirtualMachinePatchStatus"] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :keyword patch_status: [Preview Feature] The status of virtual machine patch operations. + :paramtype patch_status: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePatchStatus + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -8257,10 +10358,10 @@ def __init__( class VirtualMachineIpTag(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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -8275,6 +10376,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -8285,11 +10392,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8308,6 +10415,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8318,31 +10432,31 @@ class VirtualMachineNetworkInterfaceConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The network interface configuration name. - :type name: str - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar name: Required. The network interface configuration name. + :vartype name: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - :param enable_accelerated_networking: Specifies whether the network interface is accelerated + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :ivar 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 enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: 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: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceIPConfiguration] - :param dscp_configuration: - :type dscp_configuration: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar dscp_configuration: + :vartype dscp_configuration: ~azure.mgmt.compute.v2021_03_01.models.SubResource """ _validation = { @@ -8377,6 +10491,33 @@ def __init__( dscp_configuration: Optional["SubResource"] = None, **kwargs ): + """ + :keyword name: Required. The network interface configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineNetworkInterfaceIPConfiguration] + :keyword dscp_configuration: + :paramtype dscp_configuration: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ super(VirtualMachineNetworkInterfaceConfiguration, self).__init__(**kwargs) self.name = name self.primary = primary @@ -8393,8 +10534,8 @@ def __init__( class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(msrest.serialization.Model): """Describes a virtual machines network configuration's DNS settings. - :param dns_servers: List of DNS servers IP addresses. - :type dns_servers: list[str] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -8407,6 +10548,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineNetworkInterfaceDnsSettingsConfiguration, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -8416,34 +10561,34 @@ class VirtualMachineNetworkInterfaceIPConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :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.SubResource - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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.IPVersions - :param application_security_groups: Specifies an array of references to application security + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersions + :ivar 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 application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :ivar application_gateway_backend_address_pools: Specifies an array of references to backend address pools of application gateways. A virtual machine can reference backend address pools of multiple application gateways. Multiple virtual machines cannot use the same application gateway. - :type application_gateway_backend_address_pools: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :ivar load_balancer_backend_address_pools: Specifies an array of references to backend address pools of load balancers. A virtual machine can reference backend address pools of one public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] """ @@ -8475,6 +10620,38 @@ def __init__( load_balancer_backend_address_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersions + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A virtual machine can reference backend address pools of + multiple application gateways. Multiple virtual machines cannot use the same application + gateway. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword load_balancer_backend_address_pools: Specifies an array of references to backend + address pools of load balancers. A virtual machine can reference backend address pools of one + public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku + load balancer]. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ super(VirtualMachineNetworkInterfaceIPConfiguration, self).__init__(**kwargs) self.name = name self.subnet = subnet @@ -8491,12 +10668,12 @@ class VirtualMachinePatchStatus(msrest.serialization.Model): 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 + :ivar 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 + :vartype available_patch_summary: ~azure.mgmt.compute.v2021_03_01.models.AvailablePatchSummary + :ivar last_patch_installation_summary: The installation summary of the latest installation operation for the virtual machine. - :type last_patch_installation_summary: + :vartype 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: @@ -8520,6 +10697,16 @@ def __init__( last_patch_installation_summary: Optional["LastPatchInstallationSummary"] = None, **kwargs ): + """ + :keyword available_patch_summary: The available patch summary of the latest assessment + operation for the virtual machine. + :paramtype available_patch_summary: + ~azure.mgmt.compute.v2021_03_01.models.AvailablePatchSummary + :keyword last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :paramtype last_patch_installation_summary: + ~azure.mgmt.compute.v2021_03_01.models.LastPatchInstallationSummary + """ super(VirtualMachinePatchStatus, self).__init__(**kwargs) self.available_patch_summary = available_patch_summary self.last_patch_installation_summary = last_patch_installation_summary @@ -8531,29 +10718,29 @@ class VirtualMachinePublicIPAddressConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The publicIP address configuration name. - :type name: str - :param sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku - :param idle_timeout_in_minutes: The idle timeout of the public IP address. - :type idle_timeout_in_minutes: int - :param delete_option: Specify what happens to the public IP address when the VM is deleted. + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar delete_option: Specify what happens to the public IP address when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions - :param dns_settings: The dns settings to be applied on the publicIP addresses . - :type dns_settings: + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :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.VirtualMachineIpTag] - :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 + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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.IPVersions - :param public_ip_allocation_method: Specify the public IP allocation type. Possible values + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersions + :ivar public_ip_allocation_method: Specify the public IP allocation type. Possible values include: "Dynamic", "Static". - :type public_ip_allocation_method: str or + :vartype public_ip_allocation_method: str or ~azure.mgmt.compute.v2021_03_01.models.PublicIPAllocationMethod """ @@ -8587,6 +10774,32 @@ def __init__( public_ip_allocation_method: Optional[Union[str, "PublicIPAllocationMethod"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword sku: Describes the public IP Sku. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword delete_option: Specify what happens to the public IP address when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersions + :keyword public_ip_allocation_method: Specify the public IP allocation type. Possible values + include: "Dynamic", "Static". + :paramtype public_ip_allocation_method: str or + ~azure.mgmt.compute.v2021_03_01.models.PublicIPAllocationMethod + """ super(VirtualMachinePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.sku = sku @@ -8604,10 +10817,10 @@ class VirtualMachinePublicIPAddressDnsSettingsConfiguration(msrest.serialization All required parameters must be populated in order to send to Azure. - :param domain_name_label: Required. The Domain name label prefix of the PublicIPAddress + :ivar domain_name_label: Required. The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. - :type domain_name_label: str + :vartype domain_name_label: str """ _validation = { @@ -8624,6 +10837,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword domain_name_label: Required. The Domain name label prefix of the PublicIPAddress + resources that will be created. The generated name label is the concatenation of the domain + name label and vm network profile unique ID. + :paramtype domain_name_label: str + """ super(VirtualMachinePublicIPAddressDnsSettingsConfiguration, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -8631,9 +10850,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -8646,6 +10865,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -8663,33 +10887,33 @@ class VirtualMachineRunCommand(Resource): :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: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype 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 + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -8741,6 +10965,35 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -8758,23 +11011,23 @@ def __init__( 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", + :ivar 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] + :vartype execution_state: str or ~azure.mgmt.compute.v2021_03_01.models.ExecutionState + :ivar execution_message: Communicate script configuration errors or execution messages. + :vartype execution_message: str + :ivar exit_code: Exit code returned from script execution. + :vartype exit_code: int + :ivar output: Script output stream. + :vartype output: str + :ivar error: Script error stream. + :vartype error: str + :ivar start_time: Script start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Script end time. + :vartype end_time: ~datetime.datetime + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _attribute_map = { @@ -8801,6 +11054,25 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword execution_state: Script execution status. Possible values include: "Unknown", + "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :paramtype execution_state: str or ~azure.mgmt.compute.v2021_03_01.models.ExecutionState + :keyword execution_message: Communicate script configuration errors or execution messages. + :paramtype execution_message: str + :keyword exit_code: Exit code returned from script execution. + :paramtype exit_code: int + :keyword output: Script output stream. + :paramtype output: str + :keyword error: Script error stream. + :paramtype error: str + :keyword start_time: Script start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Script end time. + :paramtype end_time: ~datetime.datetime + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) self.execution_state = execution_state self.execution_message = execution_message @@ -8815,12 +11087,12 @@ def __init__( 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 + :ivar script: Specifies the script content to be executed on the VM. + :vartype script: str + :ivar script_uri: Specifies the script download location. + :vartype script_uri: str + :ivar command_id: Specifies a commandId of predefined built-in script. + :vartype command_id: str """ _attribute_map = { @@ -8837,6 +11109,14 @@ def __init__( command_id: Optional[str] = None, **kwargs ): + """ + :keyword script: Specifies the script content to be executed on the VM. + :paramtype script: str + :keyword script_uri: Specifies the script download location. + :paramtype script_uri: str + :keyword command_id: Specifies a commandId of predefined built-in script. + :paramtype command_id: str + """ super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) self.script = script self.script_uri = script_uri @@ -8848,10 +11128,10 @@ class VirtualMachineRunCommandsListResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of run commands. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :ivar next_link: The uri to fetch the next page of run commands. + :vartype next_link: str """ _validation = { @@ -8870,6 +11150,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of run commands. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :keyword next_link: The uri to fetch the next page of run commands. + :paramtype next_link: str + """ super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8880,31 +11166,31 @@ class VirtualMachineRunCommandUpdate(UpdateResource): 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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype 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 + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -8947,6 +11233,33 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -8974,70 +11287,70 @@ class VirtualMachineScaleSet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :ivar 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: + :vartype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine Scale Set. + :vartype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype 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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar 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 + :vartype single_placement_group: bool + :ivar 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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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 + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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. + :vartype host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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 + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :ivar 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. + :vartype scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :ivar 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 + :vartype orchestration_mode: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationMode """ _validation = { @@ -9102,6 +11415,70 @@ def __init__( orchestration_mode: Optional[Union[str, "OrchestrationMode"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine Scale Set. + :paramtype extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :keyword orchestration_mode: Specifies the orchestration mode for the virtual machine scale + set. Possible values include: "Uniform", "Flexible". + :paramtype orchestration_mode: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationMode + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -9130,39 +11507,39 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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 + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype 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 + :ivar 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. + :vartype disk_iops_read_write: long + :ivar 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 + :vartype disk_m_bps_read_write: long """ _validation = { @@ -9196,6 +11573,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword 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. + :paramtype disk_iops_read_write: long + :keyword 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. + :paramtype disk_m_bps_read_write: long + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -9215,37 +11627,37 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -9285,6 +11697,35 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.type = None @@ -9305,11 +11746,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9328,6 +11769,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9336,13 +11784,14 @@ def __init__( 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 + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype extensions_time_budget: str """ _attribute_map = { @@ -9357,6 +11806,16 @@ def __init__( extensions_time_budget: Optional[str] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype extensions_time_budget: str + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions self.extensions_time_budget = extensions_time_budget @@ -9373,33 +11832,33 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -9439,6 +11898,33 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -9465,17 +11951,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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: + :vartype type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -9498,6 +11983,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -9530,6 +12029,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -9546,8 +12047,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :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 statuses: The resource status information. + :vartype 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] @@ -9572,6 +12073,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -9601,6 +12106,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -9610,39 +12117,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype 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 + :ivar 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 + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :ivar 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: + :vartype 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 + :ivar 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 + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :ivar 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: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :ivar 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. + :vartype load_balancer_inbound_nat_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 = { @@ -9677,6 +12185,44 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -9692,10 +12238,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -9710,6 +12256,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -9720,11 +12272,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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 + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9743,6 +12296,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9753,11 +12314,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9776,6 +12337,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9786,11 +12354,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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 + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9809,6 +12377,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9819,11 +12394,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9842,6 +12417,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9850,14 +12432,16 @@ def __init__( 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: + :ivar 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 + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :ivar 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 + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -9872,6 +12456,18 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -9882,31 +12478,31 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar 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: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype 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 - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions """ _validation = { @@ -9941,6 +12537,33 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -9956,8 +12579,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -9970,6 +12593,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -9977,17 +12604,17 @@ def __init__( 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 + :ivar 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: + :vartype health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion """ _attribute_map = { @@ -10004,6 +12631,19 @@ def __init__( network_api_version: Optional[Union[str, "NetworkApiVersion"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -10015,43 +12655,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :ivar 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 + :vartype diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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 + :vartype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -10087,6 +12727,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -10103,20 +12783,19 @@ def __init__( 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 + :ivar 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. - :type admin_username: str - :param admin_password: Specifies the password of the administrator account. + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -10130,28 +12809,28 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar 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 + :vartype windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :ivar 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 `_. - :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. To install certificates on a virtual machine it is recommended to - use the `Azure Key Vault virtual machine extension for Linux + :vartype linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. To install certificates on a virtual machine it is recommended to use the + `Azure Key Vault virtual machine extension for Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + :vartype secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] """ _attribute_map = { @@ -10176,6 +12855,57 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. To install certificates on a virtual machine it is recommended to + use the `Azure Key Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -10191,26 +12921,26 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo All required parameters must be populated in order to send to Azure. - :param name: Required. The publicIP address configuration name. - :type name: str - :param sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku - :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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype 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 + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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 - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions """ _validation = { @@ -10241,6 +12971,28 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword sku: Describes the public IP Sku. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.sku = sku @@ -10257,10 +13009,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -10277,6 +13029,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -10284,9 +13042,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -10299,19 +13057,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -10326,6 +13089,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -10359,6 +13131,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -10400,6 +13174,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -10410,21 +13186,22 @@ def __init__( 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 + :ivar 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 + :vartype image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :ivar 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 + :vartype os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSDisk + :ivar 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] + :vartype data_disks: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -10441,6 +13218,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -10450,45 +13245,45 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :ivar 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: + :vartype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype 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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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 + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :ivar 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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :ivar 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 + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource """ _attribute_map = { @@ -10525,6 +13320,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -10543,34 +13381,34 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype 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 + :ivar 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: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype 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 + :ivar 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: + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_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 = { @@ -10601,6 +13439,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -10616,30 +13486,30 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar 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: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype 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 - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions """ _attribute_map = { @@ -10670,6 +13540,32 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -10685,17 +13581,17 @@ def __init__( 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 + :ivar 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: + :vartype health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion """ _attribute_map = { @@ -10712,6 +13608,19 @@ def __init__( network_api_version: Optional[Union[str, "NetworkApiVersion"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_03_01.models.NetworkApiVersion + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -10721,23 +13630,23 @@ def __init__( 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 + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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: + :vartype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -10761,6 +13670,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -10773,14 +13702,14 @@ def __init__( 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] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] """ _attribute_map = { @@ -10799,6 +13728,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -10809,16 +13748,16 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions """ _attribute_map = { @@ -10837,6 +13776,18 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_03_01.models.DeleteOptions + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -10847,12 +13798,13 @@ def __init__( 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] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -10869,6 +13821,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -10878,31 +13839,33 @@ def __init__( 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: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype 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: + :ivar security_profile: The virtual machine scale set Security profile. + :vartype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype 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. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar 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 + :vartype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :ivar 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 + :vartype user_data: str """ _attribute_map = { @@ -10933,6 +13896,35 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword security_profile: The virtual machine scale set Security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -10959,20 +13951,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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 + :ivar 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 + :vartype 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. @@ -10985,29 +13977,29 @@ class VirtualMachineScaleSetVM(Resource): :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 + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :ivar 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 + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :ivar 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: + :vartype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar 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 + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -11017,10 +14009,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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 + :vartype 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 + :ivar 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: @@ -11030,16 +14022,16 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype 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 + :ivar 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 + :vartype user_data: str """ _validation = { @@ -11108,6 +14100,69 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMProtectionPolicy + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -11144,32 +14199,33 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -11209,6 +14265,33 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) self.name = None self.type = None @@ -11227,8 +14310,8 @@ def __init__( 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] + :ivar value: The list of VMSS VM extensions. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] """ _attribute_map = { @@ -11241,6 +14324,11 @@ def __init__( value: Optional[List["VirtualMachineScaleSetVMExtension"]] = None, **kwargs ): + """ + :keyword value: The list of VMSS VM extensions. + :paramtype value: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] + """ super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -11271,6 +14359,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -11287,28 +14377,28 @@ class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _validation = { @@ -11344,6 +14434,30 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -11360,10 +14474,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -11376,6 +14490,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -11385,8 +14505,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -11403,6 +14523,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -11412,39 +14536,39 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype 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: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype 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 + :ivar 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] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype 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 + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -11482,6 +14606,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -11502,11 +14654,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :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 + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -11525,6 +14677,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -11533,8 +14692,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -11548,6 +14707,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -11555,27 +14719,27 @@ def __init__( 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: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :ivar 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. + :vartype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :ivar 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: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype 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 + :ivar 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: @@ -11585,28 +14749,29 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :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. + :vartype license_type: str + :ivar 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 + :vartype priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype 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. + :ivar 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 virtual machines in the scale set, which must be base-64 + :vartype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :ivar user_data: UserData for the virtual machines in the scale set, 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 + :vartype user_data: str """ _attribute_map = { @@ -11641,6 +14806,61 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :paramtype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionProfile + :keyword 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. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :keyword user_data: UserData for the virtual machines in the scale set, which must be base-64 + encoded. Customer should not pass any secrets in here. :code:`
    `:code:`
    `Minimum + api-version: 2021-03-01. + :paramtype user_data: str + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -11659,13 +14879,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -11680,6 +14900,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -11688,24 +14917,24 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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. For + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. For Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or https://docs.microsoft.com/rest/api/compute/resourceskus/list. - :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 + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -11728,6 +14957,26 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. For + Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM + uses. For accurate vCPU count, please refer to + https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or + https://docs.microsoft.com/rest/api/compute/resourceskus/list. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -11740,8 +14989,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSize] """ _attribute_map = { @@ -11754,6 +15003,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -11819,6 +15072,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -11857,6 +15112,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -11867,37 +15124,37 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :ivar 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 + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :ivar 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 + :vartype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :ivar 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. + :vartype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :ivar 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 + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -11910,46 +15167,45 @@ class VirtualMachineUpdate(UpdateResource): 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 + :vartype availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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 + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype 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. + :ivar 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. + :vartype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar 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 + :vartype 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 + :ivar 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: @@ -11959,16 +15215,16 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -11976,12 +15232,13 @@ class VirtualMachineUpdate(UpdateResource): 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 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 + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :ivar 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 + :vartype user_data: str """ _validation = { @@ -12049,6 +15306,118 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -12081,11 +15450,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -12098,6 +15467,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -12105,31 +15481,31 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". + :vartype enable_automatic_updates: bool + :ivar 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 + :vartype time_zone: str + :ivar 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: + :vartype 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 + :ivar 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 + :vartype patch_settings: ~azure.mgmt.compute.v2021_03_01.models.PatchSettings + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2021_03_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2021_03_01.models.WinRMConfiguration """ _attribute_map = { @@ -12152,6 +15528,33 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword 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 + `_. + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2021_03_01.models.AdditionalUnattendContent] + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :paramtype patch_settings: ~azure.mgmt.compute.v2021_03_01.models.PatchSettings + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2021_03_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -12164,20 +15567,20 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Windows. - :type classifications_to_include: list[str or + :vartype 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 + :ivar kb_numbers_to_include: Kbs to include in the patch operation. + :vartype kb_numbers_to_include: list[str] + :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :vartype kb_numbers_to_exclude: list[str] + :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :type exclude_kbs_requiring_reboot: bool - :param max_patch_publish_date: This is used to install patches that were published on or before + :vartype exclude_kbs_requiring_reboot: bool + :ivar max_patch_publish_date: This is used to install patches that were published on or before this given max published date. - :type max_patch_publish_date: ~datetime.datetime + :vartype max_patch_publish_date: ~datetime.datetime """ _attribute_map = { @@ -12198,6 +15601,22 @@ def __init__( max_patch_publish_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Windows. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchClassificationWindows] + :keyword kb_numbers_to_include: Kbs to include in the patch operation. + :paramtype kb_numbers_to_include: list[str] + :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :paramtype kb_numbers_to_exclude: list[str] + :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :paramtype exclude_kbs_requiring_reboot: bool + :keyword max_patch_publish_date: This is used to install patches that were published on or + before this given max published date. + :paramtype max_patch_publish_date: ~datetime.datetime + """ super(WindowsParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.kb_numbers_to_include = kb_numbers_to_include @@ -12209,8 +15628,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2021_03_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2021_03_01.models.WinRMListener] """ _attribute_map = { @@ -12223,6 +15642,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2021_03_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -12230,11 +15653,11 @@ def __init__( 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 + :ivar 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 + :vartype protocol: str or ~azure.mgmt.compute.v2021_03_01.models.ProtocolTypes + :ivar 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 @@ -12245,7 +15668,7 @@ class WinRMListener(msrest.serialization.Model): Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type certificate_url: str + :vartype certificate_url: str """ _attribute_map = { @@ -12260,6 +15683,24 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2021_03_01.models.ProtocolTypes + :keyword 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:`
    `} :code:`
    ` To install certificates on a + virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for + Linux `_ or the + `Azure Key Vault virtual machine extension for Windows + `_. + :paramtype certificate_url: str + """ 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/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py index a0edd7868f13..42f1081f7583 100644 --- 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 @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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] + :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"] @@ -313,36 +542,31 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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] + :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"] @@ -385,35 +612,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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] + :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"] @@ -460,36 +686,33 @@ def list_available_sizes( 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py index ba021c0aa999..d15a54ced68a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py @@ -5,23 +5,161 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_os_version_request( + location: str, + os_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "osVersionName": _SERIALIZER.url("os_version_name", os_version_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_os_versions_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_family_request( + location: str, + os_family_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "osFamilyName": _SERIALIZER.url("os_family_name", os_family_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_os_families_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudServiceOperatingSystemsOperations(object): """CloudServiceOperatingSystemsOperations operations. @@ -45,13 +183,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_os_version( self, - location, # type: str - os_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OSVersion" + location: str, + os_version_name: str, + **kwargs: Any + ) -> "_models.OSVersion": """Gets properties of a guest operating system version that can be specified in the XML service configuration (.cscfg) for a cloud service. @@ -69,27 +207,17 @@ def get_os_version( 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_os_version.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'osVersionName': self._serialize.url("os_version_name", os_version_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 = build_get_os_version_request( + location=location, + os_version_name=os_version_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,14 +231,16 @@ def get_os_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_os_version.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}'} # type: ignore + + @distributed_trace def list_os_versions( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OSVersionListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.OSVersionListResult"]: """Gets a list of all guest operating system versions available to be specified in the XML service configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this till nextLink is null to fetch all the OS versions. @@ -119,7 +249,8 @@ def list_os_versions( :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 OSVersionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSVersionListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSVersionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OSVersionListResult"] @@ -127,35 +258,31 @@ def list_os_versions( 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_os_versions.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_versions_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_os_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_versions_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OSVersionListResult', pipeline_response) + deserialized = self._deserialize("OSVersionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -173,18 +300,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_os_versions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions'} # type: ignore + @distributed_trace def get_os_family( self, - location, # type: str - os_family_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OSFamily" + location: str, + os_family_name: str, + **kwargs: Any + ) -> "_models.OSFamily": """Gets properties of a guest operating system family that can be specified in the XML service configuration (.cscfg) for a cloud service. @@ -202,27 +330,17 @@ def get_os_family( 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_os_family.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'osFamilyName': self._serialize.url("os_family_name", os_family_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 = build_get_os_family_request( + location=location, + os_family_name=os_family_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_family.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,14 +354,16 @@ def get_os_family( return cls(pipeline_response, deserialized, {}) return deserialized + get_os_family.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}'} # type: ignore + + @distributed_trace def list_os_families( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OSFamilyListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.OSFamilyListResult"]: """Gets a list of all guest operating system families available to be specified in the XML service configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this till nextLink is null to fetch all the OS Families. @@ -260,35 +380,31 @@ def list_os_families( 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_os_families.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_families_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_os_families.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_os_families_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OSFamilyListResult', pipeline_response) + deserialized = self._deserialize("OSFamilyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -306,6 +422,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 080d26681b83..61973ee4a8d7 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 @@ -5,25 +5,329 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, IO, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_delete_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_rebuild_request_initial( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_remote_desktop_file_request( + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/x-rdp" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile') + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudServiceRoleInstancesOperations(object): """CloudServiceRoleInstancesOperations operations. @@ -49,39 +353,28 @@ def __init__(self, client, config, serializer, deserializer): def _delete_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,14 +387,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a role instance from a cloud service. :param role_instance_name: Name of the role instance. @@ -112,15 +406,17 @@ def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -135,22 +431,14 @@ def begin_delete( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -162,17 +450,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + @distributed_trace def get( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleInstance" + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.RoleInstance": """Gets a role instance from a cloud service. :param role_instance_name: Name of the role instance. @@ -194,30 +483,19 @@ def get( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,16 +509,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + @distributed_trace def get_instance_view( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleInstanceView" + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.RoleInstanceView": """Retrieves information about the run-time state of a role instance in a cloud service. :param role_instance_name: Name of the role instance. @@ -259,28 +539,18 @@ def get_instance_view( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,16 +564,18 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cloud_service_name, # type: str - expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleInstanceListResult"] + resource_group_name: str, + cloud_service_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> Iterable["_models.RoleInstanceListResult"]: """Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances. @@ -316,8 +588,10 @@ def list( cloud services. :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] + :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] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] @@ -325,38 +599,35 @@ def list( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleInstanceListResult', pipeline_response) + deserialized = self._deserialize("RoleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -374,6 +645,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -381,39 +653,28 @@ def get_next(next_link=None): def _restart_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_restart_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,14 +687,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. @@ -445,15 +707,17 @@ def begin_restart( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -468,22 +732,14 @@ def begin_restart( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -495,43 +751,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore def _reimage_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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._reimage_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_reimage_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -544,14 +790,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles. @@ -563,15 +810,17 @@ def begin_reimage( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -586,22 +835,14 @@ def begin_reimage( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -613,43 +854,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore def _rebuild_initial( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_rebuild_request_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -662,14 +893,15 @@ def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + @distributed_trace def begin_rebuild( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instance. @@ -682,15 +914,17 @@ def begin_rebuild( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -705,22 +939,14 @@ def begin_rebuild( 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 = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -732,16 +958,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + @distributed_trace def get_remote_desktop_file( self, - role_instance_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> IO + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> IO: """Gets a remote desktop file for a role instance in a cloud service. :param role_instance_name: Name of the role instance. @@ -760,28 +987,18 @@ def get_remote_desktop_file( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/x-rdp" - - # Construct URL - url = self.get_remote_desktop_file.metadata['url'] # type: ignore - path_format_arguments = { - 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_remote_desktop_file_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_remote_desktop_file.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) response = pipeline_response.http_response @@ -795,4 +1012,6 @@ def get_remote_desktop_file( return cls(pipeline_response, deserialized, {}) return deserialized + get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py index 89b28454aef8..8eb45a04334d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py @@ -5,23 +5,97 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + role_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}') + path_format_arguments = { + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudServiceRolesOperations(object): """CloudServiceRolesOperations operations. @@ -45,14 +119,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - role_name, # type: str - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudServiceRole" + role_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.CloudServiceRole": """Gets a role from a cloud service. :param role_name: Name of the role. @@ -71,28 +145,18 @@ def get( 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 = { - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + role_name=role_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,15 +170,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudServiceRoleListResult"] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> Iterable["_models.CloudServiceRoleListResult"]: """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. Do this till nextLink is null to fetch all the roles. @@ -123,8 +189,10 @@ def list( :param cloud_service_name: :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceRoleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleListResult] + :return: An iterator like instance of either CloudServiceRoleListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] @@ -132,36 +200,33 @@ def list( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceRoleListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceRoleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -179,6 +244,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py index 3e0de227b912..35d22e11b2d2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py @@ -5,25 +5,531 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_rebuild_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class CloudServicesOperations(object): """CloudServicesOperations operations. @@ -49,46 +555,35 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudService"] - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudService" + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudService"] = None, + **kwargs: Any + ) -> "_models.CloudService": cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudService') + _json = self._serialize.body(parameters, 'CloudService') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,16 +601,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudService"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CloudService"] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudService"] = None, + **kwargs: Any + ) -> LROPoller["_models.CloudService"]: """Create or update a cloud service. Please note some properties can be set only during cloud service creation. @@ -127,15 +624,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CloudService or the result of cls(response) + :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 CloudService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +648,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,50 +674,40 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudServiceUpdate"] - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudService" + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudServiceUpdate"] = None, + **kwargs: Any + ) -> "_models.CloudService": cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'CloudServiceUpdate') + _json = self._serialize.body(parameters, 'CloudServiceUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,16 +721,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.CloudServiceUpdate"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CloudService"] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudServiceUpdate"] = None, + **kwargs: Any + ) -> LROPoller["_models.CloudService"]: """Update a cloud service. :param resource_group_name: Name of the resource group. @@ -256,15 +743,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CloudService or the result of cls(response) + :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 CloudService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,27 +767,21 @@ def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CloudService', 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -308,41 +793,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -355,13 +830,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a cloud service. :param resource_group_name: Name of the resource group. @@ -370,15 +846,17 @@ def begin_delete( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -392,21 +870,14 @@ def begin_delete( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -418,15 +889,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudService" + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.CloudService": """Display information about a cloud service. :param resource_group_name: Name of the resource group. @@ -443,27 +915,17 @@ def get( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,15 +939,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudServiceInstanceView" + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> "_models.CloudServiceInstanceView": """Gets the status of a cloud service. :param resource_group_name: Name of the resource group. @@ -502,27 +966,17 @@ def get_instance_view( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -536,20 +990,24 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudServiceListResult"] + **kwargs: Any + ) -> Iterable["_models.CloudServiceListResult"]: """Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -557,34 +1015,29 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,17 +1055,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudServiceListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.CloudServiceListResult"]: """Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. @@ -620,8 +1074,10 @@ def list( :param resource_group_name: 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 CloudServiceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] + :return: An iterator like instance of either CloudServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] @@ -629,35 +1085,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + deserialized = self._deserialize("CloudServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -675,6 +1127,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -682,37 +1135,26 @@ def get_next(next_link=None): def _start_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_start_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,13 +1167,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts the cloud service. :param resource_group_name: Name of the resource group. @@ -740,15 +1183,17 @@ def begin_start( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -762,21 +1207,14 @@ def begin_start( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -788,41 +1226,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore def _power_off_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> 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._power_off_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,13 +1263,14 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + @distributed_trace def begin_power_off( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Power off the cloud service. Note that resources are still attached and you are getting charged for the resources. @@ -851,15 +1280,17 @@ def begin_power_off( :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -873,21 +1304,14 @@ def begin_power_off( 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -899,50 +1323,40 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/poweroff'} # type: ignore def _restart_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -955,14 +1369,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more role instances in a cloud service. :param resource_group_name: Name of the resource group. @@ -973,15 +1388,18 @@ def begin_restart( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -993,24 +1411,18 @@ def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1022,50 +1434,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore def _reimage_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1078,14 +1480,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. @@ -1097,15 +1500,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1117,24 +1523,18 @@ def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1146,50 +1546,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore def _rebuild_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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") - accept = "application/json" - - # Construct URL - url = self._rebuild_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_rebuild_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._rebuild_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1202,14 +1592,15 @@ def _rebuild_initial( _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + @distributed_trace def begin_rebuild( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instances. @@ -1222,15 +1613,18 @@ def begin_rebuild( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1242,24 +1636,18 @@ def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1271,50 +1659,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore def _delete_instances_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> 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") - accept = "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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'RoleInstances') + _json = self._serialize.body(parameters, 'RoleInstances') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1327,14 +1705,15 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + + @distributed_trace def begin_delete_instances( self, - resource_group_name, # type: str - cloud_service_name, # type: str - parameters=None, # type: Optional["_models.RoleInstances"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes role instances in a cloud service. :param resource_group_name: Name of the resource group. @@ -1345,15 +1724,18 @@ def begin_delete_instances( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1365,24 +1747,18 @@ def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1394,4 +1770,5 @@ def get_long_running_output(pipeline_response): ) 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/cloudServices/{cloudServiceName}/delete'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py index 2b3e1ecaa702..45744c6623a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py @@ -5,25 +5,146 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_walk_update_domain_request_initial( + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "updateDomain": _SERIALIZER.url("update_domain", update_domain, 'int'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_domain_request( + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "updateDomain": _SERIALIZER.url("update_domain", update_domain, 'int'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_update_domains_request( + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudServicesUpdateDomainOperations(object): """CloudServicesUpdateDomainOperations operations. @@ -49,48 +170,37 @@ def __init__(self, client, config, serializer, deserializer): def _walk_update_domain_initial( self, - resource_group_name, # type: str - cloud_service_name, # type: str - update_domain, # type: int - parameters=None, # type: Optional["_models.UpdateDomain"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional["_models.UpdateDomain"] = None, + **kwargs: Any + ) -> 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") - accept = "application/json" - - # Construct URL - url = self._walk_update_domain_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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] if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateDomain') + _json = self._serialize.body(parameters, 'UpdateDomain') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_walk_update_domain_request_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._walk_update_domain_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,15 +213,16 @@ def _walk_update_domain_initial( _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace def begin_walk_update_domain( self, - resource_group_name, # type: str - cloud_service_name, # type: str - update_domain, # type: int - parameters=None, # type: Optional["_models.UpdateDomain"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional["_models.UpdateDomain"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Updates the role instances in the specified update domain. :param resource_group_name: Name of the resource group. @@ -126,15 +237,18 @@ def begin_walk_update_domain( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -147,25 +261,18 @@ def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + content_type=content_type, 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'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - '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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,16 +284,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + @distributed_trace def get_update_domain( self, - resource_group_name, # type: str - cloud_service_name, # type: str - update_domain, # type: int - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateDomain" + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + **kwargs: Any + ) -> "_models.UpdateDomain": """Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page of update domains. Do this till nextLink is null to fetch all the update domains. @@ -209,28 +317,18 @@ def get_update_domain( 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_update_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), - 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), - 'subscriptionId': self._serialize.url("self._config.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 = build_get_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + subscription_id=self._config.subscription_id, + template_url=self.get_update_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,15 +342,17 @@ def get_update_domain( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + @distributed_trace def list_update_domains( self, - resource_group_name, # type: str - cloud_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UpdateDomainListResult"] + resource_group_name: str, + cloud_service_name: str, + **kwargs: Any + ) -> Iterable["_models.UpdateDomainListResult"]: """Gets a list of all update domains in a cloud service. :param resource_group_name: Name of the resource group. @@ -260,8 +360,10 @@ def list_update_domains( :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UpdateDomainListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.UpdateDomainListResult] + :return: An iterator like instance of either UpdateDomainListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] @@ -269,36 +371,33 @@ def list_update_domains( 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_update_domains.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_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) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_update_domains.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UpdateDomainListResult', pipeline_response) + deserialized = self._deserialize("UpdateDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -316,6 +415,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index 8d0ed20c14e2..f62b25932dff 100644 --- 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 @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +296,22 @@ def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +359,22 @@ def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +388,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +415,17 @@ def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,14 +438,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -267,29 +467,18 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,22 +492,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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] + :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"] @@ -326,35 +519,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -372,22 +561,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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] + :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"] @@ -395,34 +587,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -440,6 +627,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index 66e770d04fc2..6eee160bcfd5 100644 --- 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 @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -463,30 +630,19 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,15 +656,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -517,8 +675,10 @@ def list_by_host_group( :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] + :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"] @@ -526,36 +686,33 @@ def list_by_host_group( 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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -573,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index 2d0e51d1eb32..0aed16cd0526 100644 --- 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 @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index 0a28c08025db..f08acb678c9c 100644 --- 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 @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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 index 9fbb3dc0b614..0705ca4d7bd3 100644 --- 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 @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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] + :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"] @@ -62,30 +91,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index b814207fa3ff..743df76995e1 100644 --- 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 @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = _SERIALIZER.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +294,22 @@ def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +327,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +357,22 @@ def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +386,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +413,17 @@ def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,14 +436,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -264,29 +464,18 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,18 +489,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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] + :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"] @@ -319,34 +512,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,24 +552,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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] + :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"] @@ -389,35 +580,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +622,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py index 538a5f7a2f17..cc40c6922bee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py @@ -5,25 +5,254 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RestorePointCollectionsOperations(object): """RestorePointCollectionsOperations operations. @@ -47,14 +276,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - parameters, # type: "_models.RestorePointCollection" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + parameters: "_models.RestorePointCollection", + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for more details. When updating a restore point collection, only tags may be modified. @@ -76,32 +305,22 @@ def create_or_update( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollection') - 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 @@ -119,16 +338,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - parameters, # type: "_models.RestorePointCollectionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + parameters: "_models.RestorePointCollectionUpdate", + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. @@ -147,32 +368,22 @@ def update( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - 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 @@ -186,41 +397,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any + ) -> 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +435,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the restore point collection. This operation will also delete all the contained restore points. @@ -249,15 +452,17 @@ def begin_delete( :type restore_point_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -271,21 +476,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -297,16 +495,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - expand=None, # type: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to get the restore point collection. :param resource_group_name: The name of the resource group. @@ -326,29 +525,18 @@ def get( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,21 +550,25 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorePointCollectionListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RestorePointCollectionListResult"]: """Gets the list of restore point collections 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 RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -384,35 +576,31 @@ def list( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,23 +618,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorePointCollectionListResult"] + **kwargs: Any + ) -> Iterable["_models.RestorePointCollectionListResult"]: """Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point collections. Do this till nextLink is not null to fetch all the restore point collections. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -454,34 +645,29 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,6 +685,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py index cb10c6b9a084..8b69124131e3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py @@ -5,24 +5,147 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RestorePointsOperations(object): """RestorePointsOperations operations. @@ -48,45 +171,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - parameters, # type: "_models.RestorePoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: "_models.RestorePoint", + **kwargs: Any + ) -> "_models.RestorePoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] 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_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePoint') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePoint') - 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 @@ -100,17 +212,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - parameters, # type: "_models.RestorePoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RestorePoint"] + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: "_models.RestorePoint", + **kwargs: Any + ) -> LROPoller["_models.RestorePoint"]: """The operation to create the restore point. Updating properties of an existing restore point is not allowed. @@ -124,15 +238,19 @@ def begin_create( :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RestorePoint :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RestorePoint or the result of cls(response) + :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 RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +263,21 @@ def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,43 +289,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,14 +328,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the restore point. :param resource_group_name: The name of the resource group. @@ -245,15 +347,17 @@ def begin_delete( :type restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -268,22 +372,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -295,16 +391,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> "_models.RestorePoint": """The operation to get the restore point. :param resource_group_name: The name of the resource group. @@ -323,28 +420,18 @@ def get( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,4 +445,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # 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 index 4cc22211d41a..a5d45ac1f295 100644 --- 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 @@ -5,23 +5,277 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_key_pair_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SshPublicKeysOperations(object): """SshPublicKeysOperations operations. @@ -45,17 +299,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + **kwargs: Any + ) -> 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] + :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"] @@ -63,34 +319,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,25 +359,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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] + :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"] @@ -134,35 +388,31 @@ def list_by_resource_group( 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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,19 +430,20 @@ def get_next(next_link=None): 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 + @distributed_trace def create( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -211,32 +462,22 @@ def create( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyResource') + + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,16 +495,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyUpdateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyUpdateResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -282,32 +525,22 @@ def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -321,15 +554,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> None: """Delete an SSH public key. :param resource_group_name: The name of the resource group. @@ -346,25 +581,17 @@ def delete( 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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,13 +604,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Retrieves information about an SSH public key. :param resource_group_name: The name of the resource group. @@ -400,27 +628,17 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,15 +652,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def generate_key_pair( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyGenerateKeyPairResult" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_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. @@ -461,27 +681,17 @@ def generate_key_pair( 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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,4 +705,6 @@ def generate_key_pair( 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 index ba685ab6e047..1bb5e708f4d0 100644 --- 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 @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index adb6fd9e159a..88eb1dd126ba 100644 --- 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 @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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 index 9496a4ace807..324335d7c5e1 100644 --- 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 @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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 index 243d9782081e..1e7a7d132329 100644 --- 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 @@ -5,22 +5,229 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + edge_zone: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + edge_zone: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesEdgeZoneOperations(object): """VirtualMachineImagesEdgeZoneOperations operations. @@ -44,17 +251,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image in an edge zone. :param location: The name of a supported Azure region. @@ -79,31 +286,21 @@ def get( 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') + + request = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -117,21 +314,23 @@ def get( 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 + + @distributed_trace 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"] + 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: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. @@ -162,36 +361,23 @@ def list( 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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,16 +391,18 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - edge_zone, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image offers for the specified location, edge zone and publisher. @@ -234,28 +422,18 @@ def list_offers( 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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -269,15 +447,17 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - edge_zone, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + **kwargs: Any + ) -> 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. @@ -294,27 +474,17 @@ def list_publishers( 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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -328,17 +498,19 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace 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"] + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. @@ -360,29 +532,19 @@ def list_skus( 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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,4 +558,6 @@ def list_skus( 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 index f1151606ab3f..1d7a5164fdc5 100644 --- 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 @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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 index 650bfaebf964..1f60a6424f18 100644 --- 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 @@ -5,25 +5,305 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -47,19 +327,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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] + :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"] @@ -67,35 +349,31 @@ def list( 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,18 +391,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -141,27 +420,17 @@ def get( 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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,49 +444,40 @@ def get( 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -235,17 +495,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the run command. :param resource_group_name: The name of the resource group. @@ -259,15 +521,20 @@ def begin_create_or_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +547,21 @@ def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,49 +573,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -369,17 +619,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the run command. :param resource_group_name: The name of the resource group. @@ -392,15 +644,20 @@ def begin_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -413,28 +670,21 @@ def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,43 +696,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,14 +735,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - run_command_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the run command. :param resource_group_name: The name of the resource group. @@ -513,15 +754,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -536,22 +779,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -563,17 +798,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the run command. :param resource_group_name: The name of the resource group. @@ -594,30 +830,19 @@ def get_by_virtual_machine( 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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -631,16 +856,18 @@ def get_by_virtual_machine( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineRunCommandsListResult"]: """The operation to get all run commands of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -650,8 +877,10 @@ def list_by_virtual_machine( :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] + :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"] @@ -659,38 +888,35 @@ def list_by_virtual_machine( 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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -708,6 +934,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index 5930da4595cd..331bc708dd50 100644 --- 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 @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +320,24 @@ def begin_create_or_update( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +350,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +376,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to update an extension. :param resource_group_name: The name of the resource group. @@ -265,18 +449,24 @@ def begin_update( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -289,28 +479,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -322,41 +505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +544,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -387,15 +563,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +588,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,17 +607,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -468,30 +639,19 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +665,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -521,8 +683,10 @@ def list( :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] + :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"] @@ -530,36 +694,33 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -577,6 +738,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index 05863a4a9644..94cca0b85d54 100644 --- 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 @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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 index 420d995e9f18..79a20607c5c9 100644 --- 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 @@ -5,24 +5,246 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMExtensionsOperations(object): """VirtualMachineScaleSetVMExtensionsOperations operations. @@ -48,47 +270,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,18 +317,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -130,18 +343,24 @@ def begin_create_or_update( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +374,21 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +400,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +448,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -271,18 +474,24 @@ def begin_update( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +505,21 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -330,45 +531,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,15 +572,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -402,15 +594,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,23 +620,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,18 +639,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMExtension": """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -488,31 +674,20 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,17 +701,19 @@ def get( 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 + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_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. @@ -557,30 +734,19 @@ def list( 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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,4 +760,6 @@ def list( 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 index b95b8b76ccfa..e99970b50e31 100644 --- 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 @@ -5,25 +5,247 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMRunCommandsOperations(object): """VirtualMachineScaleSetVMRunCommandsOperations operations. @@ -49,47 +271,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -107,18 +318,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -133,15 +346,20 @@ def begin_create_or_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +373,21 @@ def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +399,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +447,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -273,15 +475,20 @@ def begin_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,29 +502,21 @@ def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -329,45 +528,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> 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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,15 +569,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -401,15 +591,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +617,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -453,18 +636,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -487,31 +671,20 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -525,17 +698,19 @@ def get( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -547,8 +722,10 @@ def list( :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] + :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"] @@ -556,39 +733,37 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +781,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index 1701b52eb7a5..1cb0642d537b 100644 --- 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 @@ -5,25 +5,615 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +639,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +682,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +701,22 @@ def begin_reimage( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +729,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +752,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +791,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +811,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +836,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +855,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +894,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +915,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +940,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +959,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +1009,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +1035,20 @@ def begin_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +1061,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,44 +1087,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,15 +1128,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -616,15 +1151,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -640,22 +1177,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -667,17 +1196,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -700,30 +1230,19 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -737,16 +1256,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -765,28 +1286,18 @@ def get_instance_view( 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -800,18 +1311,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -828,8 +1341,10 @@ def list( '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] + :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"] @@ -837,42 +1352,39 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -890,6 +1402,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -897,40 +1410,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -943,15 +1446,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -968,15 +1472,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -992,22 +1498,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1019,41 +1517,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1066,14 +1556,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1084,15 +1575,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1107,22 +1600,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1134,41 +1619,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1181,14 +1658,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1199,15 +1677,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1222,22 +1702,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1249,41 +1721,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1296,14 +1760,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1315,15 +1780,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1338,22 +1805,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1365,17 +1824,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_models.RetrieveBootDiagnosticsDataResult": """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. @@ -1399,30 +1859,19 @@ def retrieve_boot_diagnostics_data( 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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1436,41 +1885,34 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1483,14 +1925,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1501,15 +1944,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1524,22 +1969,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1551,16 +1988,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -1579,26 +2017,18 @@ def simulate_eviction( 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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1611,47 +2041,37 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1667,17 +2087,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1690,15 +2112,19 @@ def begin_run_command( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1711,28 +2137,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1744,4 +2163,5 @@ def get_long_running_output(pipeline_response): ) 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 index 816120fc4b22..cc9d361c48d2 100644 --- 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 @@ -5,25 +5,938 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_set_orchestration_service_state_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -47,19 +960,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + location: str, + **kwargs: Any + ) -> 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] + :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"] @@ -67,35 +982,31 @@ def list_by_location( 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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +1024,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1032,32 @@ def get_next(next_link=None): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -174,16 +1075,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -194,15 +1097,20 @@ def begin_create_or_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,27 +1122,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -246,47 +1148,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -300,16 +1192,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -320,15 +1214,20 @@ def begin_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -340,27 +1239,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,42 +1265,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -420,14 +1304,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -438,15 +1323,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -461,21 +1348,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -487,16 +1367,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -517,29 +1398,18 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -553,48 +1423,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -607,14 +1470,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -624,18 +1488,22 @@ def begin_deallocate( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -647,24 +1515,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -676,48 +1538,39 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -730,15 +1583,16 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -746,21 +1600,25 @@ def begin_delete_instances( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -773,24 +1631,18 @@ def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -802,15 +1654,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -827,27 +1680,17 @@ def get_instance_view( 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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -861,21 +1704,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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] + :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"] @@ -883,35 +1730,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -929,23 +1772,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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] + :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"] @@ -953,34 +1799,29 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -998,18 +1839,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -1018,8 +1860,10 @@ def list_skus( :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] + :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"] @@ -1027,36 +1871,33 @@ def list_skus( 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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1074,18 +1915,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1093,8 +1935,10 @@ def get_os_upgrade_history( :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] + :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"] @@ -1102,36 +1946,33 @@ def get_os_upgrade_history( 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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1149,6 +1990,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1156,47 +1998,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1209,15 +2041,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1231,18 +2064,22 @@ def begin_power_off( 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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1255,24 +2092,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1284,48 +2115,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1338,14 +2161,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1353,18 +2177,22 @@ def begin_restart( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1376,24 +2204,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1405,48 +2227,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1459,14 +2273,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1474,18 +2289,22 @@ def begin_start( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1497,24 +2316,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1526,48 +2339,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1580,14 +2385,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1596,18 +2402,22 @@ def begin_redeploy( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1619,24 +2429,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1648,48 +2452,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1702,14 +2498,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1720,18 +2517,22 @@ def begin_perform_maintenance( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1743,24 +2544,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1772,45 +2567,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1823,14 +2610,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1838,18 +2626,22 @@ def begin_update_instances( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1861,24 +2653,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1890,48 +2676,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1944,14 +2722,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1961,18 +2740,22 @@ def begin_reimage( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1984,24 +2767,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2013,48 +2790,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2067,14 +2836,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -2083,18 +2853,22 @@ def begin_reimage_all( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2106,24 +2880,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2135,16 +2903,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2165,28 +2934,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2200,16 +2959,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2217,7 +2978,8 @@ def convert_to_single_placement_group( :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 + :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 @@ -2228,30 +2990,22 @@ def convert_to_single_placement_group( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2264,43 +3018,35 @@ def convert_to_single_placement_group( 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2313,14 +3059,15 @@ def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. @@ -2331,15 +3078,18 @@ def begin_set_orchestration_service_state( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2351,24 +3101,18 @@ def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2380,4 +3124,5 @@ def get_long_running_output(pipeline_response): ) 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 index de26658fcaf7..eff2cbff4fca 100644 --- 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 @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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] + :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"] @@ -66,35 +103,31 @@ def list( 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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 index ee1c1d93cd7a..d28d07a33adb 100644 --- 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 @@ -5,25 +5,907 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_assess_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +929,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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] + :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"] @@ -67,35 +951,31 @@ def list_by_location( 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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +993,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1001,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +1042,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +1065,20 @@ def begin_capture( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either 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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +1090,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +1116,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +1164,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. @@ -324,15 +1187,19 @@ def begin_create_or_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -344,27 +1211,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,47 +1237,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -430,16 +1281,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -450,15 +1303,19 @@ def begin_update( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -470,27 +1327,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -502,42 +1353,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,34 +1392,36 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -592,21 +1436,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -618,16 +1455,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_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. @@ -649,29 +1487,18 @@ def get( 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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -685,15 +1512,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -710,27 +1539,17 @@ def instance_view( 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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -744,39 +1563,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -789,13 +1601,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -805,15 +1618,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -827,21 +1642,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -853,39 +1661,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -898,13 +1698,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -914,15 +1715,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -936,21 +1739,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -962,15 +1758,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 @@ -992,25 +1789,17 @@ def generalize( 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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1023,20 +1812,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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] + :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"] @@ -1044,35 +1836,31 @@ def list( 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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1090,17 +1878,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - status_only=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + status_only: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -1108,8 +1897,10 @@ def list_all( 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] + :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"] @@ -1117,36 +1908,31 @@ def list_all( 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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1164,18 +1950,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1184,8 +1971,10 @@ def list_available_sizes( :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] + :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"] @@ -1193,36 +1982,33 @@ def list_available_sizes( 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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1240,6 +2026,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1247,38 +2034,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1291,14 +2068,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1312,15 +2090,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1335,21 +2115,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1361,41 +2134,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1408,13 +2171,14 @@ def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace def begin_reapply( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to reapply a virtual machine's state. :param resource_group_name: The name of the resource group. @@ -1423,15 +2187,17 @@ def begin_reapply( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1445,21 +2211,14 @@ def begin_reapply( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1471,39 +2230,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1516,13 +2267,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1531,15 +2283,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1553,21 +2307,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1579,39 +2326,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1624,13 +2363,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1639,15 +2379,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1661,21 +2403,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1687,39 +2422,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1732,13 +2459,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1747,15 +2475,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1769,21 +2499,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1795,48 +2518,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1849,14 +2564,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1867,15 +2583,18 @@ def begin_reimage( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1887,24 +2606,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1916,16 +2629,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_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. @@ -1946,29 +2660,18 @@ def retrieve_boot_diagnostics_data( 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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1982,39 +2685,32 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2027,13 +2723,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -2042,15 +2739,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2064,21 +2763,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2090,15 +2782,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """The operation to simulate the eviction of spot virtual machine. :param resource_group_name: The name of the resource group. @@ -2115,25 +2808,17 @@ def simulate_eviction( 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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2146,39 +2831,29 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2194,15 +2869,17 @@ def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace def begin_assess_patches( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineAssessPatchesResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineAssessPatchesResult"]: """Assess patches on the VM. :param resource_group_name: The name of the resource group. @@ -2211,15 +2888,19 @@ def begin_assess_patches( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2233,24 +2914,17 @@ def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2262,47 +2936,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2318,16 +2982,18 @@ def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineInstallPatchesResult"]: """Installs patches on the VM. :param resource_group_name: The name of the resource group. @@ -2335,18 +3001,24 @@ def begin_install_patches( :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 + :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2358,27 +3030,21 @@ def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2390,47 +3056,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2446,16 +3102,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2466,15 +3124,19 @@ def begin_run_command( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2486,27 +3148,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2518,4 +3174,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py index 68074079617d..aa4402b24a3a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py @@ -6,224 +6,193 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, RestorePointCollectionsOperations, RestorePointsOperations, SnapshotsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -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 RestorePointCollectionsOperations -from .operations import RestorePointsOperations -from .operations import CapacityReservationGroupsOperations -from .operations import CapacityReservationsOperations -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 .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .operations import DiskRestorePointOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2021_04_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2021_04_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2021_04_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2021_04_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2021_04_01.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2021_04_01.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2021_04_01.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.v2021_04_01.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2021_04_01.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineImagesOperations :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineImagesEdgeZoneOperations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineImagesEdgeZoneOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2021_04_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2021_04_01.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2021_04_01.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations - :vartype restore_point_collections: azure.mgmt.compute.v2021_04_01.operations.RestorePointCollectionsOperations + :vartype restore_point_collections: + azure.mgmt.compute.v2021_04_01.operations.RestorePointCollectionsOperations :ivar restore_points: RestorePointsOperations operations :vartype restore_points: azure.mgmt.compute.v2021_04_01.operations.RestorePointsOperations :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: azure.mgmt.compute.v2021_04_01.operations.CapacityReservationGroupsOperations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2021_04_01.operations.CapacityReservationGroupsOperations :ivar capacity_reservations: CapacityReservationsOperations operations - :vartype capacity_reservations: azure.mgmt.compute.v2021_04_01.operations.CapacityReservationsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype capacity_reservations: + azure.mgmt.compute.v2021_04_01.operations.CapacityReservationsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2021_04_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2021_04_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2021_04_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_04_01.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2021_04_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_04_01.operations.VirtualMachineScaleSetVMRunCommandsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2021_04_01.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2021_04_01.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2021_04_01.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2021_04_01.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2021_04_01.operations.DiskAccessesOperations :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.v2021_04_01.operations.DiskRestorePointOperations + :vartype disk_restore_point: + azure.mgmt.compute.v2021_04_01.operations.DiskRestorePointOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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.restore_point_collections = RestorePointCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservations = CapacityReservationsOperations( - 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) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.restore_point_collections = RestorePointCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservation_groups = CapacityReservationGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservations = CapacityReservationsOperations(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) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py index 3616bd314cca..691320acdacf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json index 5849cb7b34fb..704303d6574f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py index 9ec2aef66f1b..becf9c0e22d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py @@ -6,220 +6,195 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, RestorePointCollectionsOperations, RestorePointsOperations, SnapshotsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -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 RestorePointCollectionsOperations -from .operations import RestorePointsOperations -from .operations import CapacityReservationGroupsOperations -from .operations import CapacityReservationsOperations -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 .operations import DisksOperations -from .operations import SnapshotsOperations -from .operations import DiskEncryptionSetsOperations -from .operations import DiskAccessesOperations -from .operations import DiskRestorePointOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2021_04_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2021_04_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2021_04_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2021_04_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2021_04_01.aio.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2021_04_01.aio.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2021_04_01.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2021_04_01.aio.operations.DedicatedHostsOperations + :vartype dedicated_hosts: + azure.mgmt.compute.v2021_04_01.aio.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2021_04_01.aio.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineImagesOperations :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineImagesEdgeZoneOperations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineImagesEdgeZoneOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2021_04_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2021_04_01.aio.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations - :vartype restore_point_collections: azure.mgmt.compute.v2021_04_01.aio.operations.RestorePointCollectionsOperations + :vartype restore_point_collections: + azure.mgmt.compute.v2021_04_01.aio.operations.RestorePointCollectionsOperations :ivar restore_points: RestorePointsOperations operations :vartype restore_points: azure.mgmt.compute.v2021_04_01.aio.operations.RestorePointsOperations :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: azure.mgmt.compute.v2021_04_01.aio.operations.CapacityReservationGroupsOperations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2021_04_01.aio.operations.CapacityReservationGroupsOperations :ivar capacity_reservations: CapacityReservationsOperations operations - :vartype capacity_reservations: azure.mgmt.compute.v2021_04_01.aio.operations.CapacityReservationsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype capacity_reservations: + azure.mgmt.compute.v2021_04_01.aio.operations.CapacityReservationsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2021_04_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2021_04_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2021_04_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_04_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2021_04_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_04_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations :ivar disks: DisksOperations operations :vartype disks: azure.mgmt.compute.v2021_04_01.aio.operations.DisksOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.compute.v2021_04_01.aio.operations.SnapshotsOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations - :vartype disk_encryption_sets: azure.mgmt.compute.v2021_04_01.aio.operations.DiskEncryptionSetsOperations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2021_04_01.aio.operations.DiskEncryptionSetsOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2021_04_01.aio.operations.DiskAccessesOperations :ivar disk_restore_point: DiskRestorePointOperations operations - :vartype disk_restore_point: azure.mgmt.compute.v2021_04_01.aio.operations.DiskRestorePointOperations + :vartype disk_restore_point: + azure.mgmt.compute.v2021_04_01.aio.operations.DiskRestorePointOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.restore_point_collections = RestorePointCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservation_groups = CapacityReservationGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservations = CapacityReservationsOperations(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) + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(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.restore_point_collections = RestorePointCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservations = CapacityReservationsOperations( - 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) - self.disks = DisksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_encryption_sets = DiskEncryptionSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_accesses = DiskAccessesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.disk_restore_point = DiskRestorePointOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py index 05317e790d49..0daea53f7094 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py index a5c2ea9fed71..cc877530387c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py index 08d9c9f87563..8b86fc6fab82 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._capacity_reservation_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroup') - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -139,32 +138,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') - 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 @@ -178,8 +167,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -205,27 +197,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,6 +220,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -255,7 +239,8 @@ async def get( the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservationGroup, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroup @@ -266,29 +251,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +276,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -318,10 +295,13 @@ def list_by_resource_group( :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -329,37 +309,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -377,11 +353,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups'} # type: ignore + @distributed_trace def list_by_subscription( self, expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, @@ -393,10 +371,13 @@ def list_by_subscription( :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -404,36 +385,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -451,6 +427,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py index 5940dfb4c885..b0ce6e59d2d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._capacity_reservations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_capacity_reservation_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservation') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservation') - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -124,15 +122,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservation :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +148,21 @@ async def begin_create_or_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +174,7 @@ def get_long_running_output(pipeline_response): ) 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore async def _update_initial( @@ -193,33 +190,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationUpdate') - 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 @@ -235,8 +222,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,15 +247,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,28 +273,21 @@ async def begin_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -311,6 +299,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore async def _delete_initial( @@ -325,28 +314,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -359,6 +338,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -378,15 +359,17 @@ async def begin_delete( :type capacity_reservation_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -401,22 +384,14 @@ async def begin_delete( 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -428,8 +403,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -449,7 +426,8 @@ async def get( :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservation, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservation @@ -460,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -497,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def list_by_capacity_reservation_group( self, resource_group_name: str, @@ -513,8 +483,10 @@ def list_by_capacity_reservation_group( :param capacity_reservation_group_name: The name of the capacity reservation group. :type capacity_reservation_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 CapacityReservationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationListResult] + :return: An iterator like instance of either CapacityReservationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] @@ -522,36 +494,33 @@ def list_by_capacity_reservation_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_capacity_reservation_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_capacity_reservation_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -569,6 +538,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py index aa42a9965d13..e75acad27bf6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -259,29 +245,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +270,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -308,8 +286,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -317,35 +297,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -363,11 +339,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -376,8 +354,10 @@ def list_by_subscription( 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_04_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -385,34 +365,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,6 +405,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py index 7be2a95d5c82..ac01e89713a4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -505,8 +476,10 @@ def list_by_host_group( :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_04_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -514,36 +487,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -561,6 +531,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py index 9a2823095e15..9819d0bd6b5e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_accesses_operations import build_create_or_update_request_initial, build_delete_a_private_endpoint_connection_request_initial, build_delete_request_initial, build_get_a_private_endpoint_connection_request, build_get_private_link_resources_request, build_get_request, build_list_by_resource_group_request, build_list_private_endpoint_connections_request, build_list_request, build_update_a_private_endpoint_connection_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2021_04_01.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type disk_access: ~azure.mgmt.compute.v2021_04_01.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of cls(response) + :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 DiskAccess or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -423,15 +397,17 @@ async def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -445,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -471,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -484,7 +455,8 @@ def list_by_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 DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -492,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -538,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -551,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskAccessList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] @@ -559,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,11 +570,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace_async async def get_private_link_resources( self, resource_group_name: str, @@ -633,27 +601,17 @@ async def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -667,8 +625,10 @@ async def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + async def _update_a_private_endpoint_connection_initial( self, resource_group_name: str, @@ -682,33 +642,23 @@ async def _update_a_private_endpoint_connection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - # 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') + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - 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 @@ -726,8 +676,11 @@ async def _update_a_private_endpoint_connection_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_update_a_private_endpoint_connection( self, resource_group_name: str, @@ -749,18 +702,24 @@ async def begin_update_a_private_endpoint_connection( :type private_endpoint_connection_name: str :param private_endpoint_connection: private endpoint connection object supplied in the body of the Put private endpoint connection operation. - :type private_endpoint_connection: ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -773,28 +732,21 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -806,8 +758,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace_async async def get_a_private_endpoint_connection( self, resource_group_name: str, @@ -835,28 +789,18 @@ async def get_a_private_endpoint_connection( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_a_private_endpoint_connection.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -870,8 +814,10 @@ async def get_a_private_endpoint_connection( return cls(pipeline_response, deserialized, {}) return deserialized + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _delete_a_private_endpoint_connection_initial( self, resource_group_name: str, @@ -884,28 +830,18 @@ async def _delete_a_private_endpoint_connection_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -918,6 +854,8 @@ async def _delete_a_private_endpoint_connection_initial( _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete_a_private_endpoint_connection( self, resource_group_name: str, @@ -937,15 +875,17 @@ async def begin_delete_a_private_endpoint_connection( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -960,22 +900,14 @@ async def begin_delete_a_private_endpoint_connection( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -987,8 +919,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_private_endpoint_connections( self, resource_group_name: str, @@ -1004,8 +938,10 @@ def list_private_endpoint_connections( are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -1013,36 +949,33 @@ def list_private_endpoint_connections( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_private_endpoint_connections.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1060,6 +993,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py index f1a5e0310efa..23e7c9873e2d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_associated_resources_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,20 @@ async def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore async def _update_initial( @@ -186,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -229,8 +217,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,8 +293,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -329,27 +321,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -363,8 +345,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -376,27 +360,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,6 +383,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -425,15 +401,17 @@ async def begin_delete( :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -447,21 +425,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,8 +444,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +458,10 @@ def list_by_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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -494,35 +469,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -552,8 +525,10 @@ def list( """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -561,34 +536,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, resource_group_name: str, @@ -627,7 +599,8 @@ def list_associated_resources( :type disk_encryption_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 ResourceUriList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ResourceUriList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] @@ -635,36 +608,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,6 +652,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py index ad795ee35ce4..e5c067a3c176 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disk_restore_point_operations import build_get_request, build_grant_access_request_initial, build_list_by_restore_point_request, build_revoke_access_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -73,29 +79,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + @distributed_trace def list_by_restore_point( self, resource_group_name: str, @@ -129,8 +128,10 @@ def list_by_restore_point( belongs. :type vm_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskRestorePointList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePointList] + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] @@ -138,37 +139,35 @@ def list_by_restore_point( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_restore_point.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, '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) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskRestorePointList', pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,6 +185,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -205,34 +205,24 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -248,8 +238,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -276,15 +269,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2021_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,29 +295,21 @@ async def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,6 +321,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -347,29 +337,19 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -382,6 +362,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -404,15 +386,17 @@ async def begin_revoke_access( :type disk_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -428,23 +412,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -456,4 +431,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py index 7a28036d418f..013e4eb06e44 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,18 @@ async def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2021_04_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +166,7 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore async def _update_initial( @@ -185,32 +181,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +238,18 @@ async def begin_update( :type disk: ~azure.mgmt.compute.v2021_04_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +287,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +315,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +339,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +354,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +377,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +395,17 @@ async def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +419,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +438,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +453,8 @@ def list_by_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 DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -490,35 +462,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +504,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +519,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiskList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] @@ -557,34 +528,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +568,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +586,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +617,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +642,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2021_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +666,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +692,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +706,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +729,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +747,17 @@ async def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +771,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +790,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py index 7e79b18534c9..14c7187f1c49 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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_04_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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_04_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py index 31f33601f6ff..ac8cd16e0e2b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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_04_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py index edfc46238974..71fa0253a8f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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_04_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py index 393ee7e9e572..82231eca6c01 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -256,29 +242,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +267,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,8 +279,10 @@ def list_by_subscription( """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_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -310,34 +290,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,11 +330,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -370,8 +347,10 @@ def list_by_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_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -379,35 +358,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,6 +400,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py index 9518b4c5480f..b7c2709e5503 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restore_point_collections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_all_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -71,32 +77,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollection') - 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 @@ -114,8 +110,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -141,32 +140,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - 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 @@ -180,8 +169,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -193,27 +184,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +207,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -241,15 +224,17 @@ async def begin_delete( :type restore_point_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -263,21 +248,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -289,8 +267,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -317,29 +297,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,8 +322,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -365,8 +337,10 @@ def list( :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 RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -374,35 +348,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -420,11 +390,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -434,8 +406,10 @@ def list_all( to fetch all the restore point collections. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -443,34 +417,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -488,6 +457,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py index c2c2a9ae9e46..4089a9a32347 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restore_points_operations import build_create_request_initial, build_delete_request_initial, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RestorePoint') - # 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') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePoint') - 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 @@ -95,8 +89,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -118,15 +115,19 @@ async def begin_create( :type parameters: ~azure.mgmt.compute.v2021_04_01.models.RestorePoint :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of cls(response) + :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 RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,28 +140,21 @@ async def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +166,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore async def _delete_initial( @@ -186,28 +181,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,6 +205,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -237,15 +224,17 @@ async def begin_delete( :type restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -260,22 +249,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -287,8 +268,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -314,28 +297,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -349,4 +322,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py index 34166cf00e9b..663eae3a14c8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -119,15 +117,19 @@ async def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2021_04_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -185,32 +182,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -228,8 +215,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -249,15 +239,19 @@ async def begin_update( :type snapshot: ~azure.mgmt.compute.v2021_04_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :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 Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +263,21 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -301,8 +289,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -327,27 +317,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +341,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,25 +356,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,6 +379,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +397,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +421,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +455,8 @@ def list_by_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 SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -490,35 +464,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +506,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +521,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SnapshotList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] @@ -557,34 +530,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +570,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -619,32 +588,22 @@ async def _grant_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') - # 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') + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -660,8 +619,11 @@ async def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace_async async def begin_grant_access( self, resource_group_name: str, @@ -682,15 +644,19 @@ async def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2021_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) + :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 AccessUri or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,27 +668,21 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -734,6 +694,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore async def _revoke_access_initial( @@ -747,25 +708,17 @@ async def _revoke_access_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -778,6 +731,8 @@ async def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace_async async def begin_revoke_access( self, resource_group_name: str, @@ -794,15 +749,17 @@ async def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -816,21 +773,14 @@ async def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -842,4 +792,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py index 03df7208c479..fcf842cae964 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._ssh_public_keys_operations import build_create_request, build_delete_request, build_generate_key_pair_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -49,8 +55,10 @@ def list_by_subscription( 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_04_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -58,34 +66,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,11 +106,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -119,8 +124,10 @@ def list_by_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 SshPublicKeysGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -128,35 +135,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,11 +177,13 @@ async def get_next(next_link=None): 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 + @distributed_trace_async async def create( self, resource_group_name: str, @@ -204,32 +209,22 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyResource') - # 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') + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,8 +242,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -274,32 +272,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,8 +301,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -337,25 +328,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,6 +351,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -390,27 +375,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +399,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def generate_key_pair( self, resource_group_name: str, @@ -450,27 +428,17 @@ async def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,4 +452,6 @@ async def generate_key_pair( 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_04_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_usage_operations.py index 1a110d3a7b53..e37049646f2a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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_04_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py index 1e3a9c6836eb..9e9cbd6df70f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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_04_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extensions_operations.py index 9eb36a637ad5..080164202f5b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index 494f5fe1bad8..1406f0781ebb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_edge_zone_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -74,31 +79,21 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -112,8 +107,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -156,36 +154,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,8 +184,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -227,28 +215,18 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -262,8 +240,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -286,27 +267,17 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -320,8 +291,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -351,29 +325,19 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -387,4 +351,6 @@ async def list_skus( 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_04_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_operations.py index 09e2f26ea36e..6283d52c646a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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_04_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_run_commands_operations.py index a99371609ca2..8815f4e5fc63 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_by_virtual_machine_request, build_get_request, build_list_by_virtual_machine_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,8 +59,10 @@ def list( :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_04_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,11 +112,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -135,27 +141,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -169,8 +165,10 @@ async def get( 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, @@ -184,33 +182,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -228,8 +216,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,28 +268,21 @@ async def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,6 +294,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -320,33 +310,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +340,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -382,15 +365,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -403,28 +391,21 @@ async def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,6 +417,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -450,28 +432,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,6 +456,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -501,15 +475,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -524,22 +500,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -551,8 +519,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_by_virtual_machine( self, resource_group_name: str, @@ -581,30 +551,19 @@ async def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -618,8 +577,11 @@ async def get_by_virtual_machine( 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 + + @distributed_trace def list_by_virtual_machine( self, resource_group_name: str, @@ -636,8 +598,10 @@ def list_by_virtual_machine( :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_04_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -645,38 +609,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +655,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 76bafc8dd643..e143ce7a8429 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :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_04_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -193,33 +191,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,18 +248,24 @@ async def begin_update( :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_04_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,28 +278,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -314,6 +304,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -328,26 +319,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +362,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +387,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,8 +406,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -457,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -494,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -509,8 +482,10 @@ def list( :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_04_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -518,36 +493,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -565,6 +537,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 3f416a20bf10..388855287dcf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index aacad79632f9..b896ef3b1073 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -124,18 +121,24 @@ async def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,18 +252,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,29 +283,21 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -322,6 +309,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -337,29 +325,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -372,6 +350,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +372,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,23 +398,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,8 +417,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -477,31 +452,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -515,8 +479,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -545,30 +512,19 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -582,4 +538,6 @@ async def list( 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_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 322c820efc1d..8ccfac8d7b5a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -102,8 +97,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +125,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -265,15 +254,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,29 +281,21 @@ async def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -321,6 +307,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -336,29 +323,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -371,6 +348,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -391,15 +370,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,23 +396,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -443,8 +415,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -476,31 +450,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -514,8 +477,11 @@ async def get( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -535,8 +501,10 @@ def list( :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_04_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -544,39 +512,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -594,6 +560,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 1848e1e08337..3ce60a5f80e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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_04_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -547,28 +514,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -581,6 +539,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -602,15 +562,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -626,22 +588,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -653,8 +607,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -685,30 +641,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -722,8 +667,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -749,28 +697,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -784,8 +722,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -811,8 +752,10 @@ def list( '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_04_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -820,42 +763,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -873,6 +813,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -891,28 +832,19 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -925,6 +857,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -949,15 +883,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -973,22 +909,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1000,6 +928,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1014,26 +943,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1046,6 +967,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1063,15 +986,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1086,22 +1011,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1113,6 +1030,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1127,26 +1045,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1159,6 +1069,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1176,15 +1088,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1199,22 +1113,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1226,6 +1132,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1240,26 +1147,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1272,6 +1171,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1290,15 +1191,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1313,22 +1216,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1340,8 +1235,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1373,30 +1270,19 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1410,8 +1296,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1424,26 +1312,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1456,6 +1336,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1473,15 +1355,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1496,22 +1380,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1523,8 +1399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -1550,26 +1428,18 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1582,6 +1452,7 @@ async def simulate_eviction( 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, @@ -1595,33 +1466,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1637,8 +1498,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1659,15 +1523,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1680,28 +1549,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1713,4 +1575,5 @@ def get_long_running_output(pipeline_response): ) 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_04_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_sets_operations.py index 6ef69b60feeb..15bfc5baeb48 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_by_location_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_set_orchestration_service_state_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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_04_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -168,8 +163,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -187,15 +185,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +210,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -239,6 +236,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -253,32 +251,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +280,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -311,15 +302,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,27 +327,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -363,6 +353,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -377,27 +368,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,6 +392,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -427,15 +411,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -450,21 +436,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -476,8 +455,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -505,29 +486,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -541,8 +511,10 @@ async def get( 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, @@ -555,33 +527,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,6 +558,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -610,18 +576,22 @@ async def begin_deallocate( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,24 +603,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -662,6 +626,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -677,32 +642,23 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -715,6 +671,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -730,21 +688,25 @@ async def begin_delete_instances( :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_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -757,24 +719,18 @@ async def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -786,8 +742,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -810,27 +768,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -844,8 +792,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -856,8 +807,10 @@ def list( :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_04_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -865,35 +818,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -911,11 +860,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -925,8 +876,10 @@ def list_all( 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_04_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -934,34 +887,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -979,11 +927,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -998,8 +948,10 @@ def list_skus( :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_04_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -1007,36 +959,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1054,11 +1003,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -1072,8 +1023,10 @@ def get_os_upgrade_history( :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_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1081,36 +1034,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1128,6 +1078,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1146,35 +1097,26 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1187,6 +1129,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1208,18 +1152,22 @@ async def begin_power_off( 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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1232,24 +1180,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1261,6 +1203,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1275,33 +1218,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1314,6 +1249,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1328,18 +1265,22 @@ async def begin_restart( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1351,24 +1292,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1380,6 +1315,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1394,33 +1330,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1433,6 +1361,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1447,18 +1377,22 @@ async def begin_start( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1470,24 +1404,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1499,6 +1427,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1513,33 +1442,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1552,6 +1473,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1567,18 +1490,22 @@ async def begin_redeploy( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1590,24 +1517,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1619,6 +1540,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1633,33 +1555,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1672,6 +1586,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1689,18 +1605,22 @@ async def begin_perform_maintenance( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1712,24 +1632,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1741,6 +1655,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1755,30 +1670,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1791,6 +1698,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1805,18 +1714,22 @@ async def begin_update_instances( :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_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1828,24 +1741,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1857,6 +1764,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1871,33 +1779,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1910,6 +1810,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1926,18 +1828,22 @@ async def begin_reimage( :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_04_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1949,24 +1855,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1978,6 +1878,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1992,33 +1893,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2031,6 +1924,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -2046,18 +1941,22 @@ async def begin_reimage_all( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2069,24 +1968,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2098,8 +1991,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2127,28 +2022,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2162,8 +2047,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2178,7 +2066,8 @@ async def convert_to_single_placement_group( :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_04_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2021_04_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 @@ -2189,30 +2078,22 @@ async def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2225,6 +2106,7 @@ async def convert_to_single_placement_group( 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, @@ -2237,30 +2119,22 @@ async def _set_orchestration_service_state_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2273,6 +2147,8 @@ async def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace_async async def begin_set_orchestration_service_state( self, resource_group_name: str, @@ -2290,15 +2166,18 @@ async def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2310,24 +2189,18 @@ async def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2339,4 +2212,5 @@ def get_long_running_output(pipeline_response): ) 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_04_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_sizes_operations.py index 808f4a9d2b85..bb5786f76405 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py index 073bb6177226..f7248ee62104 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_assess_patches_request_initial, build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_install_patches_request_initial, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_reapply_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -315,15 +306,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -367,6 +357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +372,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,8 +401,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,15 +423,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,27 +448,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -491,6 +474,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -505,27 +489,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +513,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -551,20 +528,21 @@ async def begin_delete( :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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,21 +557,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -605,8 +576,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -635,29 +608,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -671,8 +633,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -695,27 +660,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -729,8 +684,10 @@ async def instance_view( 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, @@ -742,25 +699,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -773,6 +722,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -788,15 +739,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -810,21 +763,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -836,6 +782,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -849,25 +796,17 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -880,6 +819,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -895,15 +836,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -917,21 +860,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -943,8 +879,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -972,25 +910,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1003,6 +933,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1014,8 +946,10 @@ def list( :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_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1023,35 +957,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1069,11 +999,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1086,8 +1018,10 @@ def list_all( 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_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1095,36 +1029,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1142,11 +1071,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1161,8 +1092,10 @@ def list_available_sizes( :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_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1170,36 +1103,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1217,6 +1147,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1234,27 +1165,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1267,6 +1189,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1287,15 +1211,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1310,21 +1236,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1336,6 +1255,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1349,27 +1269,17 @@ async def _reapply_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1382,6 +1292,8 @@ async def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace_async async def begin_reapply( self, resource_group_name: str, @@ -1396,15 +1308,17 @@ async def begin_reapply( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1418,21 +1332,14 @@ async def begin_reapply( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1444,6 +1351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1457,25 +1365,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1488,6 +1388,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1502,15 +1404,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1524,21 +1428,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1550,6 +1447,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1563,25 +1461,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1594,6 +1484,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1608,15 +1500,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1630,21 +1524,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1656,6 +1543,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1669,25 +1557,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1700,6 +1580,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1714,15 +1596,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,21 +1620,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1762,6 +1639,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1776,33 +1654,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1815,6 +1685,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1832,15 +1704,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1852,24 +1727,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1881,8 +1750,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1910,29 +1781,18 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1946,8 +1806,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1959,25 +1821,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1990,6 +1844,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -2004,15 +1860,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2026,21 +1884,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2052,8 +1903,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -2076,25 +1929,17 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2107,6 +1952,7 @@ async def simulate_eviction( 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, @@ -2118,27 +1964,17 @@ async def _assess_patches_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2154,8 +1990,11 @@ async def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace_async async def begin_assess_patches( self, resource_group_name: str, @@ -2170,15 +2009,19 @@ async def begin_assess_patches( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2192,24 +2035,17 @@ async def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2221,6 +2057,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2235,32 +2072,22 @@ async def _install_patches_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2276,8 +2103,11 @@ async def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace_async async def begin_install_patches( self, resource_group_name: str, @@ -2292,18 +2122,24 @@ async def begin_install_patches( :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_04_01.models.VirtualMachineInstallPatchesParameters + :type install_patches_input: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2315,27 +2151,21 @@ async def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2347,6 +2177,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2361,32 +2192,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2402,8 +2223,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -2421,15 +2245,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2441,27 +2270,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2473,4 +2296,5 @@ def get_long_running_output(pipeline_response): ) 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_04_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/__init__.py index 72303e98a92c..74cd4db5462a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/__init__.py @@ -6,560 +6,282 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessUri - 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 CapacityReservation - from ._models_py3 import CapacityReservationGroup - from ._models_py3 import CapacityReservationGroupInstanceView - from ._models_py3 import CapacityReservationGroupListResult - from ._models_py3 import CapacityReservationGroupUpdate - from ._models_py3 import CapacityReservationInstanceView - from ._models_py3 import CapacityReservationInstanceViewWithName - from ._models_py3 import CapacityReservationListResult - from ._models_py3 import CapacityReservationProfile - from ._models_py3 import CapacityReservationUpdate - from ._models_py3 import CapacityReservationUtilization - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import CreationData - 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 Disk - from ._models_py3 import DiskAccess - from ._models_py3 import DiskAccessList - from ._models_py3 import DiskAccessUpdate - from ._models_py3 import DiskEncryptionSet - from ._models_py3 import DiskEncryptionSetList - from ._models_py3 import DiskEncryptionSetParameters - from ._models_py3 import DiskEncryptionSetUpdate - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskList - from ._models_py3 import DiskRestorePoint - from ._models_py3 import DiskRestorePointList - from ._models_py3 import DiskSecurityProfile - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import Encryption - from ._models_py3 import EncryptionSetIdentity - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement - from ._models_py3 import ExtendedLocation - from ._models_py3 import GrantAccessData - from ._models_py3 import HardwareProfile - from ._models_py3 import Image - from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDisk - from ._models_py3 import ImageDiskReference - 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 InstanceViewStatus - from ._models_py3 import KeyForDiskEncryptionSet - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference - 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 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 OSProfile - 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 PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import PropertyUpdatesInProgress - from ._models_py3 import ProximityPlacementGroup - from ._models_py3 import ProximityPlacementGroupListResult - from ._models_py3 import ProximityPlacementGroupUpdate - from ._models_py3 import ProxyOnlyResource - from ._models_py3 import ProxyResource - from ._models_py3 import PublicIPAddressSku - from ._models_py3 import PurchasePlan - from ._models_py3 import PurchasePlanAutoGenerated - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - from ._models_py3 import ResourceUriList - from ._models_py3 import RestorePoint - from ._models_py3 import RestorePointCollection - from ._models_py3 import RestorePointCollectionListResult - from ._models_py3 import RestorePointCollectionSourceProperties - from ._models_py3 import RestorePointCollectionUpdate - from ._models_py3 import RestorePointProvisioningDetails - from ._models_py3 import RestorePointSourceMetadata - from ._models_py3 import RestorePointSourceVMDataDisk - from ._models_py3 import RestorePointSourceVMOSDisk - from ._models_py3 import RestorePointSourceVMStorageProfile - from ._models_py3 import RetrieveBootDiagnosticsDataResult - 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 ShareInfoElement - from ._models_py3 import Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotList - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault - from ._models_py3 import SpotRestorePolicy - 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 StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import SubResourceWithColocationStatus - from ._models_py3 import SupportedCapabilities - from ._models_py3 import TerminateNotificationProfile - from ._models_py3 import ThrottledRequestsInput - from ._models_py3 import UefiSettings - 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 VirtualMachineIpTag - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineNetworkInterfaceConfiguration - from ._models_py3 import VirtualMachineNetworkInterfaceDnsSettingsConfiguration - from ._models_py3 import VirtualMachineNetworkInterfaceIPConfiguration - from ._models_py3 import VirtualMachinePatchStatus - from ._models_py3 import VirtualMachinePublicIPAddressConfiguration - from ._models_py3 import VirtualMachinePublicIPAddressDnsSettingsConfiguration - 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 AccessUri # type: ignore - 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 CapacityReservation # type: ignore - from ._models import CapacityReservationGroup # type: ignore - from ._models import CapacityReservationGroupInstanceView # type: ignore - from ._models import CapacityReservationGroupListResult # type: ignore - from ._models import CapacityReservationGroupUpdate # type: ignore - from ._models import CapacityReservationInstanceView # type: ignore - from ._models import CapacityReservationInstanceViewWithName # type: ignore - from ._models import CapacityReservationListResult # type: ignore - from ._models import CapacityReservationProfile # type: ignore - from ._models import CapacityReservationUpdate # type: ignore - from ._models import CapacityReservationUtilization # type: ignore - from ._models import ComputeOperationListResult # type: ignore - from ._models import ComputeOperationValue # type: ignore - from ._models import CreationData # 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 Disk # type: ignore - from ._models import DiskAccess # type: ignore - from ._models import DiskAccessList # type: ignore - from ._models import DiskAccessUpdate # type: ignore - from ._models import DiskEncryptionSet # type: ignore - from ._models import DiskEncryptionSetList # type: ignore - from ._models import DiskEncryptionSetParameters # type: ignore - from ._models import DiskEncryptionSetUpdate # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import DiskList # type: ignore - from ._models import DiskRestorePoint # type: ignore - from ._models import DiskRestorePointList # type: ignore - from ._models import DiskSecurityProfile # type: ignore - from ._models import DiskSku # type: ignore - from ._models import DiskUpdate # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionSetIdentity # type: ignore - from ._models import EncryptionSettingsCollection # type: ignore - from ._models import EncryptionSettingsElement # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import GrantAccessData # 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 ImageDiskReference # 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 InstanceViewStatus # type: ignore - from ._models import KeyForDiskEncryptionSet # type: ignore - from ._models import KeyVaultAndKeyReference # type: ignore - from ._models import KeyVaultAndSecretReference # 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 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 OSProfile # 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 PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import PropertyUpdatesInProgress # type: ignore - from ._models import ProximityPlacementGroup # type: ignore - from ._models import ProximityPlacementGroupListResult # type: ignore - from ._models import ProximityPlacementGroupUpdate # type: ignore - from ._models import ProxyOnlyResource # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import PublicIPAddressSku # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import PurchasePlanAutoGenerated # type: ignore - from ._models import RecoveryWalkResponse # type: ignore - from ._models import RequestRateByIntervalInput # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceUriList # type: ignore - from ._models import RestorePoint # type: ignore - from ._models import RestorePointCollection # type: ignore - from ._models import RestorePointCollectionListResult # type: ignore - from ._models import RestorePointCollectionSourceProperties # type: ignore - from ._models import RestorePointCollectionUpdate # type: ignore - from ._models import RestorePointProvisioningDetails # type: ignore - from ._models import RestorePointSourceMetadata # type: ignore - from ._models import RestorePointSourceVMDataDisk # type: ignore - from ._models import RestorePointSourceVMOSDisk # type: ignore - from ._models import RestorePointSourceVMStorageProfile # type: ignore - from ._models import RetrieveBootDiagnosticsDataResult # 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 ShareInfoElement # type: ignore - from ._models import Sku # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotList # type: ignore - from ._models import SnapshotSku # type: ignore - from ._models import SnapshotUpdate # type: ignore - from ._models import SourceVault # type: ignore - from ._models import SpotRestorePolicy # 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 StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import SubResourceWithColocationStatus # type: ignore - from ._models import SupportedCapabilities # type: ignore - from ._models import TerminateNotificationProfile # type: ignore - from ._models import ThrottledRequestsInput # type: ignore - from ._models import UefiSettings # 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 VirtualMachineIpTag # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineNetworkInterfaceConfiguration # type: ignore - from ._models import VirtualMachineNetworkInterfaceDnsSettingsConfiguration # type: ignore - from ._models import VirtualMachineNetworkInterfaceIPConfiguration # type: ignore - from ._models import VirtualMachinePatchStatus # type: ignore - from ._models import VirtualMachinePublicIPAddressConfiguration # type: ignore - from ._models import VirtualMachinePublicIPAddressDnsSettingsConfiguration # 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 ._models_py3 import AccessUri +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 CapacityReservation +from ._models_py3 import CapacityReservationGroup +from ._models_py3 import CapacityReservationGroupInstanceView +from ._models_py3 import CapacityReservationGroupListResult +from ._models_py3 import CapacityReservationGroupUpdate +from ._models_py3 import CapacityReservationInstanceView +from ._models_py3 import CapacityReservationInstanceViewWithName +from ._models_py3 import CapacityReservationListResult +from ._models_py3 import CapacityReservationProfile +from ._models_py3 import CapacityReservationUpdate +from ._models_py3 import CapacityReservationUtilization +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import CreationData +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 Disk +from ._models_py3 import DiskAccess +from ._models_py3 import DiskAccessList +from ._models_py3 import DiskAccessUpdate +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetParameters +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskList +from ._models_py3 import DiskRestorePoint +from ._models_py3 import DiskRestorePointList +from ._models_py3 import DiskSecurityProfile +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import ExtendedLocation +from ._models_py3 import GrantAccessData +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDisk +from ._models_py3 import ImageDiskReference +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 InstanceViewStatus +from ._models_py3 import KeyForDiskEncryptionSet +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +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 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 OSProfile +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 PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import PropertyUpdatesInProgress +from ._models_py3 import ProximityPlacementGroup +from ._models_py3 import ProximityPlacementGroupListResult +from ._models_py3 import ProximityPlacementGroupUpdate +from ._models_py3 import ProxyOnlyResource +from ._models_py3 import ProxyResource +from ._models_py3 import PublicIPAddressSku +from ._models_py3 import PurchasePlan +from ._models_py3 import PurchasePlanAutoGenerated +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceUriList +from ._models_py3 import RestorePoint +from ._models_py3 import RestorePointCollection +from ._models_py3 import RestorePointCollectionListResult +from ._models_py3 import RestorePointCollectionSourceProperties +from ._models_py3 import RestorePointCollectionUpdate +from ._models_py3 import RestorePointSourceMetadata +from ._models_py3 import RestorePointSourceVMDataDisk +from ._models_py3 import RestorePointSourceVMOSDisk +from ._models_py3 import RestorePointSourceVMStorageProfile +from ._models_py3 import RetrieveBootDiagnosticsDataResult +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 ShareInfoElement +from ._models_py3 import Sku +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SpotRestorePolicy +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 StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import SubResourceWithColocationStatus +from ._models_py3 import SupportedCapabilities +from ._models_py3 import TerminateNotificationProfile +from ._models_py3 import ThrottledRequestsInput +from ._models_py3 import UefiSettings +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 VirtualMachineIpTag +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineNetworkInterfaceConfiguration +from ._models_py3 import VirtualMachineNetworkInterfaceDnsSettingsConfiguration +from ._models_py3 import VirtualMachineNetworkInterfaceIPConfiguration +from ._models_py3 import VirtualMachinePatchStatus +from ._models_py3 import VirtualMachinePublicIPAddressConfiguration +from ._models_py3 import VirtualMachinePublicIPAddressDnsSettingsConfiguration +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 + from ._compute_management_client_enums import ( AccessLevel, @@ -773,7 +495,6 @@ 'RestorePointCollectionListResult', 'RestorePointCollectionSourceProperties', 'RestorePointCollectionUpdate', - 'RestorePointProvisioningDetails', 'RestorePointSourceMetadata', 'RestorePointSourceVMDataDisk', 'RestorePointSourceVMOSDisk', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py index d0032bc2af61..f39e7fdd9b25 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" READ = "Read" WRITE = "Write" -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -40,7 +25,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -51,15 +36,15 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class CapacityReservationGroupInstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CapacityReservationGroupInstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTANCE_VIEW = "instanceView" -class CapacityReservationInstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CapacityReservationInstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTANCE_VIEW = "instanceView" -class ConsistencyModeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConsistencyModeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the consistency mode for the restore point. Please refer to https://aka.ms/RestorePoints for more details. """ @@ -68,7 +53,7 @@ class ConsistencyModeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_SYSTEM_CONSISTENT = "FileSystemConsistent" APPLICATION_CONSISTENT = "ApplicationConsistent" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -79,20 +64,20 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DeleteOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify what happens to the network interface when the VM is deleted """ DELETE = "Delete" DETACH = "Detach" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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 @@ -105,7 +90,7 @@ class DiffDiskPlacement(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CACHE_DISK = "CacheDisk" RESOURCE_DISK = "ResourceDisk" -class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible sources of a disk's creation. """ @@ -131,7 +116,7 @@ class DiskCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: complete only after all data has been copied from the source. COPY_START = "CopyStart" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -144,7 +129,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class DiskDeleteOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskDeleteOptionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the behavior of the managed disk when the VM gets deleted i.e whether the managed disk is deleted or detached. Supported values::code:`
    `:code:`
    ` **Delete** If this value is used, the managed disk is deleted when VM gets deleted.:code:`
    `:code:`
    ` **Detach** @@ -155,7 +140,7 @@ class DiskDeleteOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DETACH = "Detach" -class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -169,7 +154,7 @@ class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) FORCE_DETACH = "ForceDetach" -class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources @@ -179,7 +164,7 @@ class DiskEncryptionSetIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionSetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -190,7 +175,7 @@ class DiskEncryptionSetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: of the keys is Customer managed and the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class DiskSecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskSecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the SecurityType of the VM. Applicable for OS disks only. """ @@ -198,7 +183,7 @@ class DiskSecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Module (vTPM). TRUSTED_LAUNCH = "TrustedLaunch" -class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This enumerates the possible state of the disk. """ @@ -219,7 +204,7 @@ class DiskState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A disk is created for upload and a write token has been issued for uploading to it. ACTIVE_UPLOAD = "ActiveUpload" -class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -240,7 +225,7 @@ class DiskStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: and dev/test that need storage resiliency against zone failures. STANDARD_SSD_ZRS = "StandardSSD_ZRS" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the data of the disk. """ @@ -254,7 +239,7 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the other key is Platform managed. ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" -class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExecutionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Script execution status. """ @@ -266,48 +251,48 @@ class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TIMED_OUT = "TimedOut" CANCELED = "Canceled" -class ExpandTypesForGetCapacityReservationGroups(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpandTypesForGetCapacityReservationGroups(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_MACHINE_SCALE_SET_VMS_REF = "virtualMachineScaleSetVMs/$ref" VIRTUAL_MACHINES_REF = "virtualMachines/$ref" -class ExpandTypesForGetVMScaleSets(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpandTypesForGetVMScaleSets(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_DATA = "userData" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class InstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTANCE_VIEW = "instanceView" USER_DATA = "userData" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -316,7 +301,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -325,7 +310,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class IPVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IPVersions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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'. @@ -334,7 +319,7 @@ class IPVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class LinuxPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinuxPatchAssessmentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` @@ -345,7 +330,7 @@ class LinuxPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinuxVMGuestPatchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - The virtual machine's @@ -357,7 +342,7 @@ class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -366,7 +351,7 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAccessPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for accessing the disk via network. """ @@ -377,14 +362,14 @@ class NetworkAccessPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The disk cannot be exported. DENY_ALL = "DenyAll" -class NetworkApiVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkApiVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations """ TWO_THOUSAND_TWENTY11_01 = "2020-11-01" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -393,35 +378,35 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class OrchestrationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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)): +class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. """ @@ -429,21 +414,21 @@ class OrchestrationServiceState(with_metaclass(_CaseInsensitiveEnumMeta, str, En RUNNING = "Running" SUSPENDED = "Suspended" -class OrchestrationServiceStateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrchestrationServiceStateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action to be performed. """ RESUME = "Resume" SUSPEND = "Suspend" -class PatchAssessmentState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class PatchInstallationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the patch after the installation operation completed. """ @@ -454,7 +439,7 @@ class PatchInstallationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) NOT_SELECTED = "NotSelected" PENDING = "Pending" -class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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." @@ -466,7 +451,7 @@ class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -475,7 +460,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -483,7 +468,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -491,7 +476,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -500,28 +485,28 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class PublicIPAddressSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAddressSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify public IP sku name """ BASIC = "Basic" STANDARD = "Standard" -class PublicIPAddressSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAddressSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify public IP sku tier """ REGIONAL = "Regional" GLOBAL_ENUM = "Global" -class PublicIPAllocationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAllocationMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify the public IP allocation type """ DYNAMIC = "Dynamic" STATIC = "Static" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for controlling export on the disk. """ @@ -534,7 +519,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -545,18 +530,18 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RestorePointCollectionExpandOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestorePointCollectionExpandOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RESTORE_POINTS = "restorePoints" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -565,7 +550,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. @@ -573,7 +558,7 @@ class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TRUSTED_LAUNCH = "TrustedLaunch" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -581,7 +566,7 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. """ @@ -592,7 +577,7 @@ class SnapshotStorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Standard zone redundant storage. STANDARD_ZRS = "Standard_ZRS" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -600,7 +585,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -618,7 +603,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PREMIUM_ZRS = "Premium_ZRS" STANDARD_SSD_ZRS = "StandardSSD_ZRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -630,7 +615,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -638,7 +623,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -647,14 +632,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -664,20 +649,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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: @@ -859,20 +844,20 @@ class VirtualMachineSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum STANDARD_NV12 = "Standard_NV12" STANDARD_NV24 = "Standard_NV24" -class VmDiskTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VmDiskTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """VM disk types which are disallowed. """ NONE = "None" UNMANAGED = "Unmanaged" -class VMGuestPatchClassificationLinux(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationLinux(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" OTHER = "Other" -class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationWindows(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" @@ -883,7 +868,7 @@ class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, TOOLS = "Tools" UPDATES = "Updates" -class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the reboot requirements of the patch. """ @@ -892,7 +877,7 @@ class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, E ALWAYS_REQUIRES_REBOOT = "AlwaysRequiresReboot" CAN_REQUEST_REBOOT = "CanRequestReboot" -class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines when it is acceptable to reboot a VM during a software update operation. """ @@ -900,7 +885,7 @@ class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, En NEVER = "Never" ALWAYS = "Always" -class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reboot state of the VM following completion of the operation. """ @@ -911,7 +896,7 @@ class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu FAILED = "Failed" COMPLETED = "Completed" -class WindowsPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WindowsPatchAssessmentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` @@ -922,7 +907,7 @@ class WindowsPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, E IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class WindowsVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WindowsVMGuestPatchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Manual** - You control the application of diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models.py deleted file mode 100644 index 1ead4747378c..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models.py +++ /dev/null @@ -1,12063 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccessUri(msrest.serialization.Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - -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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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_04_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2021_04_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2021_04_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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 `Availability sets overview `_. :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance and updates 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. - - 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_04_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_04_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_04_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2021_04_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 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_04_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_04_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_04_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2021_04_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, - **kwargs - ): - 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 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_04_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_04_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, - **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_04_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 CapacityReservation(Resource): - """Specifies information about the capacity reservation. - - 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 resource for which capacity needs be reserved. The SKU name - and capacity is required to be set. Currently VM Skus with the capability called - 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs - in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported - values. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.Sku - :param zones: Availability Zone to use for this capacity reservation. The zone has to be single - value and also should be part for the list of zones specified during the capacity reservation - group creation. The zone can be assigned only during creation. If not provided, the reservation - supports only non-zonal deployments. If provided, enforces VM/VMSS using this capacity - reservation to be in same zone. - :type zones: list[str] - :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the - platform which does not change throughout the lifetime of the resource. - :vartype reservation_id: str - :ivar virtual_machines_associated: A list of all virtual machine resource ids that are - associated with the capacity reservation. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_04_01.models.SubResourceReadOnly] - :ivar provisioning_time: The date time when the capacity reservation was last updated. - :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 Capacity reservation instance view. - :vartype instance_view: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceView - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'reservation_id': {'readonly': True}, - 'virtual_machines_associated': {'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'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'reservation_id': {'key': 'properties.reservationId', 'type': 'str'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservation, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.zones = kwargs.get('zones', None) - self.reservation_id = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - - -class CapacityReservationGroup(Resource): - """Specifies information about the capacity reservation group that the capacity reservations should be assigned to. :code:`
    `:code:`
    ` Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation cannot be added or moved to another capacity reservation 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 Zones to use for this capacity reservation group. The zones can be - assigned only during creation. If not provided, the group supports only regional resources in - the region. If provided, enforces each capacity reservation in the group to be in one of the - zones. - :type zones: list[str] - :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to - capacity reservation group. - :vartype capacity_reservations: - list[~azure.mgmt.compute.v2021_04_01.models.SubResourceReadOnly] - :ivar virtual_machines_associated: A list of references to all virtual machines associated to - the capacity reservation group. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_04_01.models.SubResourceReadOnly] - :ivar instance_view: The capacity reservation group instance view which has the list of - instance views for all the capacity reservations that belong to the capacity reservation group. - :vartype instance_view: - ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceView - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'capacity_reservations': {'readonly': True}, - 'virtual_machines_associated': {'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]'}, - 'capacity_reservations': {'key': 'properties.capacityReservations', 'type': '[SubResourceReadOnly]'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationGroupInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroup, self).__init__(**kwargs) - self.zones = kwargs.get('zones', None) - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None - - -class CapacityReservationGroupInstanceView(msrest.serialization.Model): - """CapacityReservationGroupInstanceView. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar capacity_reservations: List of instance view of the capacity reservations under the - capacity reservation group. - :vartype capacity_reservations: - list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceViewWithName] - """ - - _validation = { - 'capacity_reservations': {'readonly': True}, - } - - _attribute_map = { - 'capacity_reservations': {'key': 'capacityReservations', 'type': '[CapacityReservationInstanceViewWithName]'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroupInstanceView, self).__init__(**kwargs) - self.capacity_reservations = None - - -class CapacityReservationGroupListResult(msrest.serialization.Model): - """The List capacity reservation group with resource group response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of capacity reservation groups. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroup] - :param next_link: The URI to fetch the next page of capacity reservation groups. Call - ListNext() with this URI to fetch the next page of capacity reservation groups. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CapacityReservationGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class CapacityReservationGroupUpdate(UpdateResource): - """Specifies information about the capacity reservation group. Only tags can 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] - :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to - capacity reservation group. - :vartype capacity_reservations: - list[~azure.mgmt.compute.v2021_04_01.models.SubResourceReadOnly] - :ivar virtual_machines_associated: A list of references to all virtual machines associated to - the capacity reservation group. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_04_01.models.SubResourceReadOnly] - :ivar instance_view: The capacity reservation group instance view which has the list of - instance views for all the capacity reservations that belong to the capacity reservation group. - :vartype instance_view: - ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceView - """ - - _validation = { - 'capacity_reservations': {'readonly': True}, - 'virtual_machines_associated': {'readonly': True}, - 'instance_view': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'capacity_reservations': {'key': 'properties.capacityReservations', 'type': '[SubResourceReadOnly]'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationGroupInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroupUpdate, self).__init__(**kwargs) - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None - - -class CapacityReservationInstanceView(msrest.serialization.Model): - """The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] - """ - - _attribute_map = { - 'utilization_info': {'key': 'utilizationInfo', 'type': 'CapacityReservationUtilization'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationInstanceView, self).__init__(**kwargs) - self.utilization_info = kwargs.get('utilization_info', None) - self.statuses = kwargs.get('statuses', None) - - -class CapacityReservationInstanceViewWithName(CapacityReservationInstanceView): - """The instance view of a capacity reservation that includes the name of the capacity reservation. It is used for the response to the instance view of a capacity reservation group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] - :ivar name: The name of the capacity reservation. - :vartype name: str - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'utilization_info': {'key': 'utilizationInfo', 'type': 'CapacityReservationUtilization'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationInstanceViewWithName, self).__init__(**kwargs) - self.name = None - - -class CapacityReservationListResult(msrest.serialization.Model): - """The list capacity reservation operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of capacity reservations. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] - :param next_link: The URI to fetch the next page of capacity reservations. Call ListNext() with - this URI to fetch the next page of capacity reservations. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CapacityReservation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class CapacityReservationProfile(msrest.serialization.Model): - """The parameters of a capacity reservation Profile. - - :param capacity_reservation_group: Specifies the capacity reservation group resource id that - should be used for allocating the virtual machine or scaleset vm instances provided enough - capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more - details. - :type capacity_reservation_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource - """ - - _attribute_map = { - 'capacity_reservation_group': {'key': 'capacityReservationGroup', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationProfile, self).__init__(**kwargs) - self.capacity_reservation_group = kwargs.get('capacity_reservation_group', None) - - -class CapacityReservationUpdate(UpdateResource): - """Specifies information about the capacity reservation. Only tags and sku.capacity can 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 sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity - is required to be set. Currently VM Skus with the capability called - 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs - in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported - values. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.Sku - :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the - platform which does not change throughout the lifetime of the resource. - :vartype reservation_id: str - :ivar virtual_machines_associated: A list of all virtual machine resource ids that are - associated with the capacity reservation. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_04_01.models.SubResourceReadOnly] - :ivar provisioning_time: The date time when the capacity reservation was last updated. - :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 Capacity reservation instance view. - :vartype instance_view: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceView - """ - - _validation = { - 'reservation_id': {'readonly': True}, - 'virtual_machines_associated': {'readonly': True}, - 'provisioning_time': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'reservation_id': {'key': 'properties.reservationId', 'type': 'str'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationUpdate, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.reservation_id = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - - -class CapacityReservationUtilization(msrest.serialization.Model): - """Represents the capacity reservation utilization in terms of resources allocated. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar virtual_machines_allocated: A list of all virtual machines resource ids allocated against - the capacity reservation. - :vartype virtual_machines_allocated: - list[~azure.mgmt.compute.v2021_04_01.models.SubResourceReadOnly] - """ - - _validation = { - 'virtual_machines_allocated': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machines_allocated': {'key': 'virtualMachinesAllocated', 'type': '[SubResourceReadOnly]'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationUtilization, self).__init__(**kwargs) - self.virtual_machines_allocated = None - - -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_04_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 CreationData(msrest.serialization.Model): - """Data used when creating a 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 create_option: Required. This enumerates the possible sources of a disk's creation. - Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", - "CopyStart". - :type create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager - identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the - ImageDiskReference will be the ARM id of the shared galley image version from which to create a - disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a - managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id identifying the source of - this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the - upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for - the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are - 512 ad 4096. 4096 is the default. - :type logical_sector_size: int - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'gallery_image_reference': {'key': 'galleryImageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - 'logical_sector_size': {'key': 'logicalSectorSize', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs['create_option'] - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.gallery_image_reference = kwargs.get('gallery_image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', None) - self.logical_sector_size = kwargs.get('logical_sector_size', 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_04_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_04_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_04_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_04_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_04_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_04_01.models.DiskDetachOptionTypes - :param delete_option: Specifies whether data disk should be deleted or detached upon VM - deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this - value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** - If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` - The default value is set to **detach**. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes - """ - - _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'}, - 'delete_option': {'key': 'deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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) - self.delete_option = kwargs.get('delete_option', None) - - -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_04_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_04_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_04_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_04_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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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_04_01.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, - } - - def __init__( - self, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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_04_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_04_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, - **kwargs - ): - 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 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_04_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. The list of dedicated host groups. - :type value: list[~azure.mgmt.compute.v2021_04_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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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_04_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_04_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, - **kwargs - ): - 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 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_04_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', None) - - -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_04_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_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, - **kwargs - ): - 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_04_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_04_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_04_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_04_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_04_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_04_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/azure/virtual-machines/windows/sizes and Linux VM at - https://docs.microsoft.com/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_04_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_04_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 Disk(Resource): - """Disk resource. - - 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 managed_by: A relative URI containing the ID of the VM that has the disk attached. - :vartype managed_by: str - :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the - disk attached. maxShares should be set to a value greater than one for disks to allow attaching - them to multiple VMs. - :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :param extended_location: The extended location where the disk will be created. Extended - location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation - :ivar time_created: The time when the disk was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was - created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: - WindowsServer}. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities for the image from which the OS - disk was created. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", - "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2021_04_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should - be set to a value greater than one for disks to allow attaching them to multiple VMs. - :vartype share_info: list[~azure.mgmt.compute.v2021_04_01.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :ivar property_updates_in_progress: Properties of the disk for which update is pending. - :vartype property_updates_in_progress: - ~azure.mgmt.compute.v2021_04_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param security_profile: Contains the security related information for the resource. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityProfile - :param completion_percent: Percentage complete for the background copy when a resource is - created via the CopyStart operation. - :type completion_percent: float - :param public_network_access: Policy for controlling export on the disk. Possible values - include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'managed_by_extended': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'share_info': {'readonly': True}, - 'property_updates_in_progress': {'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}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'managed_by_extended': {'key': 'managedByExtended', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlanAutoGenerated'}, - 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'share_info': {'key': 'properties.shareInfo', 'type': '[ShareInfoElement]'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, - 'property_updates_in_progress': {'key': 'properties.propertyUpdatesInProgress', 'type': 'PropertyUpdatesInProgress'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'DiskSecurityProfile'}, - 'completion_percent': {'key': 'properties.completionPercent', 'type': 'float'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.managed_by_extended = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.extended_location = kwargs.get('extended_location', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.supported_capabilities = kwargs.get('supported_capabilities', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.disk_state = None - self.encryption = kwargs.get('encryption', None) - self.max_shares = kwargs.get('max_shares', None) - self.share_info = None - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - self.bursting_enabled = kwargs.get('bursting_enabled', None) - self.property_updates_in_progress = None - self.supports_hibernation = kwargs.get('supports_hibernation', None) - self.security_profile = kwargs.get('security_profile', None) - self.completion_percent = kwargs.get('completion_percent', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class DiskAccess(Resource): - """disk access resource. - - 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 where the disk access will be created. Extended - location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation - :ivar private_endpoint_connections: A readonly collection of private endpoint connections - created on the disk. Currently only one endpoint connection is supported. - :vartype private_endpoint_connections: - list[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] - :ivar provisioning_state: The disk access resource provisioning state. - :vartype provisioning_state: str - :ivar time_created: The time when the disk access was created. - :vartype time_created: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'time_created': {'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'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccess, self).__init__(**kwargs) - self.extended_location = kwargs.get('extended_location', None) - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None - - -class DiskAccessList(msrest.serialization.Model): - """The List disk access operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with - this to fetch the next page of disk access resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskAccess]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskAccessList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskAccessUpdate(msrest.serialization.Model): - """Used for updating a disk access resource. - - :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(DiskAccessUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DiskEncryptionSet(Resource): - """disk encryption set resource. - - 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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet - :ivar previous_keys: A readonly collection of key vault keys previously used by this disk - encryption set while a key rotation is in progress. It will be empty if there is no ongoing key - rotation. - :vartype previous_keys: list[~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet] - :ivar provisioning_state: The disk encryption set provisioning state. - :vartype provisioning_state: str - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of - this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool - :ivar last_key_rotation_timestamp: The time when the active key of this disk encryption set was - updated. - :vartype last_key_rotation_timestamp: ~datetime.datetime - :ivar auto_key_rotation_error: The error that was encountered during auto-key rotation. If an - error is present, then auto-key rotation will not be attempted until the error on this disk - encryption set is fixed. - :vartype auto_key_rotation_error: ~azure.mgmt.compute.v2021_04_01.models.ApiError - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'previous_keys': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - 'auto_key_rotation_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}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, - 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyForDiskEncryptionSet]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'rotation_to_latest_key_version_enabled': {'key': 'properties.rotationToLatestKeyVersionEnabled', 'type': 'bool'}, - 'last_key_rotation_timestamp': {'key': 'properties.lastKeyRotationTimestamp', 'type': 'iso-8601'}, - 'auto_key_rotation_error': {'key': 'properties.autoKeyRotationError', 'type': 'ApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSet, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - self.previous_keys = None - self.provisioning_state = None - self.rotation_to_latest_key_version_enabled = kwargs.get('rotation_to_latest_key_version_enabled', None) - self.last_key_rotation_timestamp = None - self.auto_key_rotation_error = None - - -class DiskEncryptionSetList(msrest.serialization.Model): - """The List disk encryption set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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_04_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_04_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 DiskEncryptionSetUpdate(msrest.serialization.Model): - """disk encryption set update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values - include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and - Snapshots. - :type active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of - this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, - 'rotation_to_latest_key_version_enabled': {'key': 'properties.rotationToLatestKeyVersionEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionSetUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.encryption_type = kwargs.get('encryption_type', None) - self.active_key = kwargs.get('active_key', None) - self.rotation_to_latest_key_version_enabled = kwargs.get('rotation_to_latest_key_version_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_04_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_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 DiskList(msrest.serialization.Model): - """The List Disks operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Disk]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ProxyOnlyResource(msrest.serialization.Model): - """The ProxyOnly Resource model definition. - - 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyOnlyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class DiskRestorePoint(ProxyOnlyResource): - """Properties of disk restore point. - - 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 time_created: The timestamp of restorePoint creation. - :vartype time_created: ~datetime.datetime - :ivar source_resource_id: arm id of source disk. - :vartype source_resource_id: str - :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". - :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was - created. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities (like accelerated networking) for - the image from which the OS disk was created. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities - :ivar family_id: id of the backing snapshot's MIS family. - :vartype family_id: str - :ivar source_unique_id: unique incarnation id of the source disk. - :vartype source_unique_id: str - :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed - keys or platform managed keys. - :vartype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param public_network_access: Policy for controlling export on the disk. Possible values - include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param completion_percent: Percentage complete for the background copy when a resource is - created via the CopyStart operation. - :type completion_percent: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'time_created': {'readonly': True}, - 'source_resource_id': {'readonly': True}, - 'os_type': {'readonly': True}, - 'family_id': {'readonly': True}, - 'source_unique_id': {'readonly': True}, - 'encryption': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlanAutoGenerated'}, - 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, - 'family_id': {'key': 'properties.familyId', 'type': 'str'}, - 'source_unique_id': {'key': 'properties.sourceUniqueId', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'completion_percent': {'key': 'properties.completionPercent', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskRestorePoint, self).__init__(**kwargs) - self.time_created = None - self.source_resource_id = None - self.os_type = None - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.supported_capabilities = kwargs.get('supported_capabilities', None) - self.family_id = None - self.source_unique_id = None - self.encryption = None - self.supports_hibernation = kwargs.get('supports_hibernation', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.completion_percent = kwargs.get('completion_percent', None) - - -class DiskRestorePointList(msrest.serialization.Model): - """The List Disk Restore Points operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of disk restore points. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePoint] - :param next_link: The uri to fetch the next page of disk restore points. Call ListNext() with - this to fetch the next page of disk restore points. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DiskRestorePoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskRestorePointList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class DiskSecurityProfile(msrest.serialization.Model): - """Contains the security related information for the resource. - - :param security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. - Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityTypes - """ - - _attribute_map = { - 'security_type': {'key': 'securityType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSecurityProfile, self).__init__(**kwargs) - self.security_type = kwargs.get('security_type', None) - - -class DiskSku(msrest.serialization.Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". - :type name: str or ~azure.mgmt.compute.v2021_04_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(msrest.serialization.Model): - """Disk update resource. - - 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: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for - UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD - disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of - 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs - mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs - mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses - the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: - https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra - disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance - target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :param purchase_plan: Purchase plan information to be added on the OS disk. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities (like accelerated networking) to - be added on the OS disk. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities - :ivar property_updates_in_progress: Properties of the disk for which update is pending. - :vartype property_updates_in_progress: - ~azure.mgmt.compute.v2021_04_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param public_network_access: Policy for controlling export on the disk. Possible values - include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess - """ - - _validation = { - 'property_updates_in_progress': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, - 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, - 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, - 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlanAutoGenerated'}, - 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, - 'property_updates_in_progress': {'key': 'properties.propertyUpdatesInProgress', 'type': 'PropertyUpdatesInProgress'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', 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) - self.disk_iops_read_only = kwargs.get('disk_iops_read_only', None) - self.disk_m_bps_read_only = kwargs.get('disk_m_bps_read_only', None) - self.max_shares = kwargs.get('max_shares', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.tier = kwargs.get('tier', None) - self.bursting_enabled = kwargs.get('bursting_enabled', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.supported_capabilities = kwargs.get('supported_capabilities', None) - self.property_updates_in_progress = None - self.supports_hibernation = kwargs.get('supports_hibernation', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class Encryption(msrest.serialization.Model): - """Encryption at rest settings for disk or snapshot. - - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling - encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: - "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", - "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2021_04_01.models.EncryptionType - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.type = kwargs.get('type', None) - - -class EncryptionSetIdentity(msrest.serialization.Model): - """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is - supported for new creations. Disk Encryption Sets can be updated with Identity type None during - migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted - resources to lose access to the keys. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetIdentityType - :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP - from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a - systemAssigned(implicit) identity. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSetIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class EncryptionSettingsCollection(msrest.serialization.Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional - KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and - KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. - Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption - with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(msrest.serialization.Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. - KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', 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_04_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 GrantAccessData(msrest.serialization.Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2021_04_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs['access'] - self.duration_in_seconds = kwargs['duration_in_seconds'] - - -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_04_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_04_01.models.ExtendedLocation - :param source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_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_04_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_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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 ImageDiskReference(msrest.serialization.Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image Repository or user image - reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates - which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.lun = kwargs.get('lun', None) - - -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_04_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_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_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_04_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 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_04_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 KeyForDiskEncryptionSet(msrest.serialization.Model): - """Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Resource id of the KeyVault containing the key or secret. This property is - optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption - Set subscription. - :type source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault - :param key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version - segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. - :type key_url: str - """ - - _validation = { - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyForDiskEncryptionSet, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.key_url = kwargs['key_url'] - - -class KeyVaultAndKeyReference(msrest.serialization.Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.key_url = kwargs['key_url'] - - -class KeyVaultAndSecretReference(msrest.serialization.Model): - """Key Vault Secret Url and vault id of the encryption key. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs['source_vault'] - self.secret_url = kwargs['secret_url'] - - -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_04_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_04_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_04_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_04_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 `_. - - :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_04_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_04_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_04_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 or virtual - machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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_04_01.models.LinuxVMGuestPatchMode - :param assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual - machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` - **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch - assessments. The property provisionVMAgent must be true. Possible values include: - "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_04_01.models.LinuxPatchAssessmentMode - """ - - _attribute_map = { - 'patch_mode': {'key': 'patchMode', 'type': 'str'}, - 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LinuxPatchSettings, self).__init__(**kwargs) - self.patch_mode = kwargs.get('patch_mode', None) - self.assessment_mode = kwargs.get('assessment_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_04_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 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_04_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_04_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_04_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_04_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 - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkInterfaceReference, self).__init__(**kwargs) - self.primary = kwargs.get('primary', None) - self.delete_option = kwargs.get('delete_option', None) - - -class NetworkProfile(msrest.serialization.Model): - """Specifies the network interfaces or the networking configuration 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_04_01.models.NetworkInterfaceReference] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations. Possible values include: - "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion - :param network_interface_configurations: Specifies the networking configurations that will be - used to create the virtual machine networking resources. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceConfiguration] - """ - - _attribute_map = { - 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterfaceReference]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineNetworkInterfaceConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkProfile, self).__init__(**kwargs) - self.network_interfaces = kwargs.get('network_interfaces', None) - self.network_api_version = kwargs.get('network_api_version', None) - self.network_interface_configurations = kwargs.get('network_interface_configurations', 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_04_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", - "Suspend". - :type action: str or ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_01.models.ManagedDiskParameters - :param delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. - :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is - used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this - value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The - default value is set to **detach**. For an ephemeral OS Disk, the default value is set to - **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values - include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes - """ - - _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'}, - 'delete_option': {'key': 'deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_04_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 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. - :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_04_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 - `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. To install certificates on a virtual machine it is recommended to use the `Azure Key - Vault virtual machine extension for Linux - `_ or the `Azure - Key Vault virtual machine extension for Windows - `_. - :type secrets: list[~azure.mgmt.compute.v2021_04_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 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_04_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 or virtual - machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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_04_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 - :param assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual - machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` - **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch - assessments. The property provisionVMAgent must be true. Possible values include: - "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_04_01.models.WindowsPatchAssessmentMode - """ - - _attribute_map = { - 'patch_mode': {'key': 'patchMode', 'type': 'str'}, - 'enable_hotpatching': {'key': 'enableHotpatching', 'type': 'bool'}, - 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, - } - - 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) - self.assessment_mode = kwargs.get('assessment_mode', 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 PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(msrest.serialization.Model): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private endpoint connection Id. - :vartype id: str - :ivar name: private endpoint connection name. - :vartype name: str - :ivar type: private endpoint connection type. - :vartype type: str - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: - ~azure.mgmt.compute.v2021_04_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'private_endpoint': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = None - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(msrest.serialization.Model): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: private link resource Id. - :vartype id: str - :ivar name: private link resource name. - :vartype name: str - :ivar type: private link resource type. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class PropertyUpdatesInProgress(msrest.serialization.Model): - """Properties of the disk for which update is pending. - - :param target_tier: The target performance tier of the disk if a tier change operation is in - progress. - :type target_tier: str - """ - - _attribute_map = { - 'target_tier': {'key': 'targetTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PropertyUpdatesInProgress, self).__init__(**kwargs) - self.target_tier = kwargs.get('target_tier', 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_04_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_04_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_04_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_04_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2021_04_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_04_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 ProxyResource(msrest.serialization.Model): - """The resource model definition for an Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PublicIPAddressSku(msrest.serialization.Model): - """Describes the public IP Sku. - - :param name: Specify public IP sku name. Possible values include: "Basic", "Standard". - :type name: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuName - :param tier: Specify public IP sku tier. Possible values include: "Regional", "Global". - :type tier: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PublicIPAddressSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -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 PurchasePlanAutoGenerated(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 name: Required. The plan ID. - :type name: str - :param publisher: Required. The publisher ID. - :type publisher: 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 - :param promotion_code: The Offer Promotion Code. - :type promotion_code: str - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, - } - - _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(PurchasePlanAutoGenerated, self).__init__(**kwargs) - self.name = kwargs['name'] - self.publisher = kwargs['publisher'] - self.product = kwargs['product'] - self.promotion_code = kwargs.get('promotion_code', None) - - -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_04_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 ResourceUriList(msrest.serialization.Model): - """The List resources which are encrypted with the disk encryption set. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the - disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with - this to fetch the next page of encrypted resources. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUriList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class RestorePoint(ProxyResource): - """Restore Point details. - - 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 - :param exclude_disks: List of disk resource ids that the customer wishes to exclude from the - restore point. If no disks are specified, all disks will be included. - :type exclude_disks: list[~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference] - :ivar source_metadata: Gets the details of the VM captured at the time of the restore point - creation. - :vartype source_metadata: ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceMetadata - :ivar provisioning_state: Gets the provisioning state of the restore point. - :vartype provisioning_state: str - :ivar consistency_mode: Gets the consistency mode for the restore point. Please refer to - https://aka.ms/RestorePoints for more details. Possible values include: "CrashConsistent", - "FileSystemConsistent", "ApplicationConsistent". - :vartype consistency_mode: str or ~azure.mgmt.compute.v2021_04_01.models.ConsistencyModeTypes - :ivar provisioning_details: Gets the provisioning details set by the server during Create - restore point operation. - :vartype provisioning_details: - ~azure.mgmt.compute.v2021_04_01.models.RestorePointProvisioningDetails - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'source_metadata': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'consistency_mode': {'readonly': True}, - 'provisioning_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'exclude_disks': {'key': 'properties.excludeDisks', 'type': '[ApiEntityReference]'}, - 'source_metadata': {'key': 'properties.sourceMetadata', 'type': 'RestorePointSourceMetadata'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'consistency_mode': {'key': 'properties.consistencyMode', 'type': 'str'}, - 'provisioning_details': {'key': 'properties.provisioningDetails', 'type': 'RestorePointProvisioningDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePoint, self).__init__(**kwargs) - self.exclude_disks = kwargs.get('exclude_disks', None) - self.source_metadata = None - self.provisioning_state = None - self.consistency_mode = None - self.provisioning_details = None - - -class RestorePointCollection(Resource): - """Create or update Restore Point collection parameters. - - 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 properties of the source resource that this restore point collection is - created from. - :type source: ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties - :ivar provisioning_state: The provisioning state of the restore point collection. - :vartype provisioning_state: str - :ivar restore_point_collection_id: The unique id of the restore point collection. - :vartype restore_point_collection_id: str - :ivar restore_points: A list containing all restore points created under this restore point - collection. - :vartype restore_points: list[~azure.mgmt.compute.v2021_04_01.models.RestorePoint] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'restore_point_collection_id': {'readonly': True}, - 'restore_points': {'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': 'RestorePointCollectionSourceProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, - 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollection, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None - - -class RestorePointCollectionListResult(msrest.serialization.Model): - """The List restore point collection operation response. - - :param value: Gets the list of restore point collections. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollection] - :param next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() - with this to fetch the next page of RestorePointCollections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorePointCollection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RestorePointCollectionSourceProperties(msrest.serialization.Model): - """The properties of the source resource that this restore point collection is created from. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of the source resource used to create this restore point collection. - :vartype location: str - :param id: Resource Id of the source resource used to create this restore point collection. - :type id: str - """ - - _validation = { - 'location': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionSourceProperties, self).__init__(**kwargs) - self.location = None - self.id = kwargs.get('id', None) - - -class RestorePointCollectionUpdate(UpdateResource): - """Update Restore Point collection parameters. - - 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 properties of the source resource that this restore point collection is - created from. - :type source: ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties - :ivar provisioning_state: The provisioning state of the restore point collection. - :vartype provisioning_state: str - :ivar restore_point_collection_id: The unique id of the restore point collection. - :vartype restore_point_collection_id: str - :ivar restore_points: A list containing all restore points created under this restore point - collection. - :vartype restore_points: list[~azure.mgmt.compute.v2021_04_01.models.RestorePoint] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'restore_point_collection_id': {'readonly': True}, - 'restore_points': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'source': {'key': 'properties.source', 'type': 'RestorePointCollectionSourceProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, - 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionUpdate, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None - - -class RestorePointProvisioningDetails(msrest.serialization.Model): - """Restore Point Provisioning details. - - :param creation_time: Gets the creation time of the restore point. - :type creation_time: ~datetime.datetime - :param total_used_size_in_bytes: Gets the total size of the data in all the disks which are - part of the restore point. - :type total_used_size_in_bytes: long - :param status_code: Gets the status of the Create restore point operation. - :type status_code: int - :param status_message: Gets the status message of the Create restore point operation. - :type status_message: str - """ - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'total_used_size_in_bytes': {'key': 'totalUsedSizeInBytes', 'type': 'long'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointProvisioningDetails, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.total_used_size_in_bytes = kwargs.get('total_used_size_in_bytes', None) - self.status_code = kwargs.get('status_code', None) - self.status_message = kwargs.get('status_message', None) - - -class RestorePointSourceMetadata(msrest.serialization.Model): - """Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point creation. - - :param hardware_profile: Gets the hardware profile. - :type hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile - :param storage_profile: Gets the storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMStorageProfile - :param os_profile: Gets the OS profile. - :type os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile - :param diagnostics_profile: Gets the diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param license_type: Gets the license type, which is for bring your own license scenario. - :type license_type: str - :param vm_id: Gets the virtual machine unique id. - :type vm_id: str - :param security_profile: Gets the security profile. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param location: Location of the VM from which the restore point was created. - :type location: str - """ - - _attribute_map = { - 'hardware_profile': {'key': 'hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'RestorePointSourceVMStorageProfile'}, - 'os_profile': {'key': 'osProfile', 'type': 'OSProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceMetadata, self).__init__(**kwargs) - self.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.license_type = kwargs.get('license_type', None) - self.vm_id = kwargs.get('vm_id', None) - self.security_profile = kwargs.get('security_profile', None) - self.location = kwargs.get('location', None) - - -class RestorePointSourceVMDataDisk(msrest.serialization.Model): - """Describes a data disk. - - :param lun: Gets the logical unit number. - :type lun: int - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes - :param disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired - size for existing OS and Data disks. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference - """ - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMDataDisk, self).__init__(**kwargs) - self.lun = kwargs.get('lun', None) - self.name = kwargs.get('name', None) - self.caching = kwargs.get('caching', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - self.disk_restore_point = kwargs.get('disk_restore_point', None) - - -class RestorePointSourceVMOSDisk(msrest.serialization.Model): - """Describes an Operating System disk. - - :param os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemType - :param encryption_settings: Gets the disk encryption settings. - :type encryption_settings: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes - :param disk_size_gb: Gets the disk size in GB. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference - """ - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': 'DiskEncryptionSettings'}, - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMOSDisk, 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.caching = kwargs.get('caching', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - self.disk_restore_point = kwargs.get('disk_restore_point', None) - - -class RestorePointSourceVMStorageProfile(msrest.serialization.Model): - """Describes the storage profile. - - :param os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. - :type os_disk: ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMOSDisk - :param data_disks: Gets the data disks of the VM captured at the time of the restore point - creation. - :type data_disks: list[~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMDataDisk] - """ - - _attribute_map = { - 'os_disk': {'key': 'osDisk', 'type': 'RestorePointSourceVMOSDisk'}, - 'data_disks': {'key': 'dataDisks', 'type': '[RestorePointSourceVMDataDisk]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMStorageProfile, self).__init__(**kwargs) - self.os_disk = kwargs.get('os_disk', None) - self.data_disks = kwargs.get('data_disks', 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 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_04_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_04_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_04_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_04_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2021_04_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2021_04_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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. - - :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_04_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 - :param 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. Possible values include: - "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_04_01.models.SecurityTypes - """ - - _attribute_map = { - 'uefi_settings': {'key': 'uefiSettings', 'type': 'UefiSettings'}, - 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, - 'security_type': {'key': 'securityType', 'type': 'str'}, - } - - 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) - self.security_type = kwargs.get('security_type', None) - - -class ShareInfoElement(msrest.serialization.Model): - """ShareInfoElement. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. - :vartype vm_uri: str - """ - - _validation = { - 'vm_uri': {'readonly': True}, - } - - _attribute_map = { - 'vm_uri': {'key': 'vmUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareInfoElement, self).__init__(**kwargs) - self.vm_uri = 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 Snapshot(Resource): - """Snapshot resource. - - 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 managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku - :param extended_location: The extended location where the snapshot will be created. Extended - location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation - :ivar time_created: The time when the snapshot was created. - :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the image from which the source disk for - the snapshot was originally created. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities (like Accelerated Networking) for - the image from which the source disk from the snapshot was originally created. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities - :param creation_data: Disk source information. CreationData information cannot be changed after - the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. - :vartype disk_size_bytes: long - :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", - "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", "ActiveUpload". - :vartype disk_state: str or ~azure.mgmt.compute.v2021_04_01.models.DiskState - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk - occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool - :param public_network_access: Policy for controlling export on the disk. Possible values - include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess - :param completion_percent: Percentage complete for the background copy when a resource is - created via the CopyStart operation. - :type completion_percent: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'disk_size_bytes': {'readonly': True}, - 'disk_state': {'readonly': True}, - 'unique_id': {'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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlanAutoGenerated'}, - 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'completion_percent': {'key': 'properties.completionPercent', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.extended_location = kwargs.get('extended_location', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.supported_capabilities = kwargs.get('supported_capabilities', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.supports_hibernation = kwargs.get('supports_hibernation', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.completion_percent = kwargs.get('completion_percent', None) - - -class SnapshotList(msrest.serialization.Model): - """The List Snapshots operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SnapshotSku(msrest.serialization.Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", - "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2021_04_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(msrest.serialization.Model): - """Snapshot update resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is - an optional parameter for incremental snapshot and the default behavior is the SKU will be set - to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it - indicates the size of the disk to create. If this field is present for updates or creation with - other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a - running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk - Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values - include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool - :param public_network_access: Policy for controlling export on the disk. Possible values - include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, - 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, - 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.encryption = kwargs.get('encryption', None) - self.network_access_policy = kwargs.get('network_access_policy', None) - self.disk_access_id = kwargs.get('disk_access_id', None) - self.supports_hibernation = kwargs.get('supports_hibernation', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class SourceVault(msrest.serialization.Model): - """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class SpotRestorePolicy(msrest.serialization.Model): - """Specifies the Spot-Try-Restore properties for the virtual machine scale set. :code:`
    `:code:`
    ` With this property customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically based on capacity availability and pricing constraint. - - :param enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be - tried to be restored opportunistically based on capacity availability and pricing constraints. - :type enabled: bool - :param restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the - platform will not try to restore the VMSS SPOT instances. - :type restore_timeout: str - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'restore_timeout': {'key': 'restoreTimeout', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SpotRestorePolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.restore_timeout = kwargs.get('restore_timeout', 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_04_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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - :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_04_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 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_04_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_04_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_04_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_04_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 SupportedCapabilities(msrest.serialization.Model): - """List of supported capabilities (like accelerated networking) persisted on the disk resource for VM use. - - :param accelerated_network: True if the image from which the OS disk is created supports - accelerated networking. - :type accelerated_network: bool - """ - - _attribute_map = { - 'accelerated_network': {'key': 'acceleratedNetwork', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedCapabilities, self).__init__(**kwargs) - self.accelerated_network = kwargs.get('accelerated_network', 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 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_04_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_04_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2021_04_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2021_04_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_04_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2021_04_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_04_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_04_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2021_04_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_04_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: An enum describing the unit of usage measurement. Has constant 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_04_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:`
    `} :code:`
    ` To install certificates on a - virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for - Linux `_ or the - `Azure Key Vault virtual machine extension for Windows - `_. - :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_04_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_04_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_04_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_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_04_01.models.ExtendedLocation - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_04_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_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2021_04_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_04_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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_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 - :param capacity_reservation: Specifies information about the capacity reservation that is used - to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile - """ - - _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'}, - 'scheduled_events_profile': {'key': 'properties.scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, - 'user_data': {'key': 'properties.userData', 'type': 'str'}, - 'capacity_reservation': {'key': 'properties.capacityReservation', 'type': 'CapacityReservationProfile'}, - } - - 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.scheduled_events_profile = kwargs.get('scheduled_events_profile', None) - self.user_data = kwargs.get('user_data', None) - self.capacity_reservation = kwargs.get('capacity_reservation', 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_04_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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_04_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_04_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_04_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_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_04_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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_04_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_04_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_04_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_04_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_04_01.models.ExtendedLocation - :param plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2021_04_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2021_04_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_04_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_04_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the - image. - :type disallowed: ~azure.mgmt.compute.v2021_04_01.models.DisallowedConfiguration - :param features: - :type features: list[~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2021_04_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2021_04_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_04_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_04_01.models.InstanceViewStatus] - :param patch_status: [Preview Feature] The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2021_04_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 VirtualMachineIpTag(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(VirtualMachineIpTag, self).__init__(**kwargs) - self.ip_tag_type = kwargs.get('ip_tag_type', None) - self.tag = kwargs.get('tag', 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_04_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 VirtualMachineNetworkInterfaceConfiguration(msrest.serialization.Model): - """Describes a virtual machine network interface configurations. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The network interface 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 delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - :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 enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceIPConfiguration] - :param dscp_configuration: - :type dscp_configuration: ~azure.mgmt.compute.v2021_04_01.models.SubResource - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, - 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, - 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, - 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineNetworkInterfaceDnsSettingsConfiguration'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineNetworkInterfaceIPConfiguration]'}, - 'dscp_configuration': {'key': 'properties.dscpConfiguration', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineNetworkInterfaceConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.primary = kwargs.get('primary', None) - self.delete_option = kwargs.get('delete_option', None) - self.enable_accelerated_networking = kwargs.get('enable_accelerated_networking', None) - self.enable_fpga = kwargs.get('enable_fpga', None) - self.enable_ip_forwarding = kwargs.get('enable_ip_forwarding', 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.dscp_configuration = kwargs.get('dscp_configuration', None) - - -class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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(VirtualMachineNetworkInterfaceDnsSettingsConfiguration, self).__init__(**kwargs) - self.dns_servers = kwargs.get('dns_servers', None) - - -class VirtualMachineNetworkInterfaceIPConfiguration(msrest.serialization.Model): - """Describes a virtual machine network profile's IP configuration. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The IP configuration name. - :type name: str - :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :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_04_01.models.VirtualMachinePublicIPAddressConfiguration - :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_04_01.models.IPVersions - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param application_gateway_backend_address_pools: Specifies an array of references to backend - address pools of application gateways. A virtual machine can reference backend address pools of - multiple application gateways. Multiple virtual machines cannot use the same application - gateway. - :type application_gateway_backend_address_pools: - list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address - pools of load balancers. A virtual machine can reference backend address pools of one public - and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load - balancer]. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachinePublicIPAddressConfiguration'}, - 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, - 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, - 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, - 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineNetworkInterfaceIPConfiguration, 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_security_groups = kwargs.get('application_security_groups', None) - self.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', None) - self.load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools', 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_04_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_04_01.models.LastPatchInstallationSummary - :ivar configuration_statuses: The enablement status of the specified patchMode. - :vartype configuration_statuses: - list[~azure.mgmt.compute.v2021_04_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 VirtualMachinePublicIPAddressConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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 sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku - :param idle_timeout_in_minutes: The idle timeout of the public IP address. - :type idle_timeout_in_minutes: int - :param delete_option: Specify what happens to the public IP address when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - :param dns_settings: The dns settings to be applied on the publicIP addresses . - :type dns_settings: - ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_04_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_04_01.models.IPVersions - :param public_ip_allocation_method: Specify the public IP allocation type. Possible values - include: "Dynamic", "Static". - :type public_ip_allocation_method: str or - ~azure.mgmt.compute.v2021_04_01.models.PublicIPAllocationMethod - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, - 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachinePublicIPAddressDnsSettingsConfiguration'}, - 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineIpTag]'}, - 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, - 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, - 'public_ip_allocation_method': {'key': 'properties.publicIPAllocationMethod', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachinePublicIPAddressConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.sku = kwargs.get('sku', None) - self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) - self.delete_option = kwargs.get('delete_option', 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) - self.public_ip_allocation_method = kwargs.get('public_ip_allocation_method', None) - - -class VirtualMachinePublicIPAddressDnsSettingsConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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 prefix of the PublicIPAddress - resources that will be created. The generated name label is the concatenation of the domain - name label and vm network profile unique ID. - :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(VirtualMachinePublicIPAddressDnsSettingsConfiguration, self).__init__(**kwargs) - self.domain_name_label = kwargs['domain_name_label'] - - -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_04_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_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_04_01.models.ExtendedLocation - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2021_04_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. zoneBalance property can only be set if the zones property of the - scale set contains more than one zone. If there are no zones or only one zone specified, then - zoneBalance property should not be set. - :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_04_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_04_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_04_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_04_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_04_01.models.OrchestrationMode - :param spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale - set. - :type spot_restore_policy: ~azure.mgmt.compute.v2021_04_01.models.SpotRestorePolicy - """ - - _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'}, - 'spot_restore_policy': {'key': 'properties.spotRestorePolicy', 'type': 'SpotRestorePolicy'}, - } - - 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) - self.spot_restore_policy = kwargs.get('spot_restore_policy', 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_04_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_04_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_04_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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_04_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_04_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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_04_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_04_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_04_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] - :ivar orchestration_services: The orchestration services information. - :vartype orchestration_services: - list[~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - """ - - _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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_04_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion - """ - - _attribute_map = { - 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - } - - 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) - self.network_api_version = kwargs.get('network_api_version', 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_04_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_04_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_04_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_04_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2021_04_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_04_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. - :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_04_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 - `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machines in the scale set. To install certificates on a virtual machine it is recommended to - use the `Azure Key Vault virtual machine extension for Linux - `_ or the `Azure - Key Vault virtual machine extension for Windows - `_. - :type secrets: list[~azure.mgmt.compute.v2021_04_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 sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku - :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_04_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_04_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_04_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_04_01.models.IPVersion - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible - values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, - '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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.sku = kwargs.get('sku', None) - 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) - self.delete_option = kwargs.get('delete_option', 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_04_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - """ - - _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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_04_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion - """ - - _attribute_map = { - 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - } - - 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) - self.network_api_version = kwargs.get('network_api_version', 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_04_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_04_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_04_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_04_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2021_04_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_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible - values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_04_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2021_04_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_04_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2021_04_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_04_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_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_04_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_04_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2021_04_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_04_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_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_04_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: - ~azure.mgmt.compute.v2021_04_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_04_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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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_04_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_04_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}, - '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'}, - '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(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 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: 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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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_04_01.models.VirtualMachineExtensionInstanceView - """ - - _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'}, - '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_04_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_04_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - """ - - _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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2021_04_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2021_04_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_04_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_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 = { - 'vm_health': {'readonly': True}, - 'assigned_host': {'readonly': True}, - } - - _attribute_map = { - '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(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 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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2021_04_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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_04_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile - :param user_data: UserData for the virtual machines in the scale set, 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 - :param capacity_reservation: Specifies the capacity reservation related details of a scale set. - :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile - """ - - _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'}, - 'capacity_reservation': {'key': 'capacityReservation', 'type': 'CapacityReservationProfile'}, - } - - 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) - self.capacity_reservation = kwargs.get('capacity_reservation', 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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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. For - Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM - uses. For accurate vCPU count, please refer to - https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or - https://docs.microsoft.com/rest/api/compute/resourceskus/list. - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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 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_04_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_04_01.models.PatchAssessmentState - """ - - _validation = { - '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 = { - '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(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 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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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_04_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_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_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_04_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_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2021_04_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_04_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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_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 - :param capacity_reservation: Specifies information about the capacity reservation that is used - to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - 'scheduled_events_profile': {'key': 'properties.scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, - 'user_data': {'key': 'properties.userData', 'type': 'str'}, - 'capacity_reservation': {'key': 'properties.capacityReservation', 'type': 'CapacityReservationProfile'}, - } - - def __init__( - self, - **kwargs - ): - 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.scheduled_events_profile = kwargs.get('scheduled_events_profile', None) - self.user_data = kwargs.get('user_data', None) - self.capacity_reservation = kwargs.get('capacity_reservation', 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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': '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_04_01.models.AdditionalUnattendContent] - :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on - Windows. - :type patch_settings: ~azure.mgmt.compute.v2021_04_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2021_04_01.models.WinRMConfiguration - """ - - _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_04_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 = { - '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(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 WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2021_04_01.models.WinRMListener] - """ - - _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_04_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:`
    `} :code:`
    ` To install certificates on a - virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for - Linux `_ or the - `Azure Key Vault virtual machine extension for Windows - `_. - :type certificate_url: str - """ - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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_04_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models_py3.py index 33a2c7938a7e..5bcc3bc084f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccessUri, self).__init__(**kwargs) self.access_sas = None @@ -42,11 +44,11 @@ def __init__( 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 + :ivar 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 + :vartype ultra_ssd_enabled: bool """ _attribute_map = { @@ -59,6 +61,13 @@ def __init__( ultra_ssd_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled @@ -66,21 +75,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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_04_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2021_04_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -99,6 +108,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2021_04_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -109,9 +135,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -124,6 +150,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -131,16 +162,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2021_04_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2021_04_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2021_04_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2021_04_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -161,6 +192,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2021_04_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2021_04_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -172,12 +215,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -194,6 +237,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -203,16 +254,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -227,6 +278,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -237,9 +300,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -256,6 +319,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -263,15 +331,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -286,6 +354,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -304,10 +383,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -332,6 +411,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -353,25 +438,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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_04_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_04_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: + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :ivar 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_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ @@ -410,6 +495,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -424,11 +531,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -447,6 +554,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -455,8 +569,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -469,6 +583,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -478,20 +596,20 @@ class AvailabilitySetUpdate(UpdateResource): 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_04_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_04_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :ivar 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_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ @@ -521,6 +639,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -587,6 +722,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailablePatchSummary, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -601,7 +738,7 @@ def __init__( 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. + :ivar 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 @@ -613,7 +750,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -626,6 +763,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -633,12 +785,12 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar 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 + :vartype storage_uri: str """ _attribute_map = { @@ -653,6 +805,14 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword 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. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -692,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -711,22 +873,22 @@ class CapacityReservation(Resource): :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 resource for which capacity needs be reserved. The SKU name - and capacity is required to be set. Currently VM Skus with the capability called + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Required. SKU of the resource for which capacity needs be reserved. The SKU name and + capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.Sku - :param zones: Availability Zone to use for this capacity reservation. The zone has to be single + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :ivar zones: Availability Zone to use for this capacity reservation. The zone has to be single value and also should be part for the list of zones specified during the capacity reservation group creation. The zone can be assigned only during creation. If not provided, the reservation supports only non-zonal deployments. If provided, enforces VM/VMSS using this capacity reservation to be in same zone. - :type zones: list[str] + :vartype zones: list[str] :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. :vartype reservation_id: str @@ -779,6 +941,24 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Required. SKU of the resource for which capacity needs be reserved. The SKU name + and capacity is required to be set. Currently VM Skus with the capability called + 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs + in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported + values. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :keyword zones: Availability Zone to use for this capacity reservation. The zone has to be + single value and also should be part for the list of zones specified during the capacity + reservation group creation. The zone can be assigned only during creation. If not provided, the + reservation supports only non-zonal deployments. If provided, enforces VM/VMSS using this + capacity reservation to be in same zone. + :paramtype zones: list[str] + """ super(CapacityReservation, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.zones = zones @@ -802,15 +982,15 @@ class CapacityReservationGroup(Resource): :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 Zones to use for this capacity reservation group. The zones can be + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar zones: Availability Zones to use for this capacity reservation group. The zones can be assigned only during creation. If not provided, the group supports only regional resources in the region. If provided, enforces each capacity reservation in the group to be in one of the zones. - :type zones: list[str] + :vartype zones: list[str] :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to capacity reservation group. :vartype capacity_reservations: @@ -855,6 +1035,17 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword zones: Availability Zones to use for this capacity reservation group. The zones can be + assigned only during creation. If not provided, the group supports only regional resources in + the region. If provided, enforces each capacity reservation in the group to be in one of the + zones. + :paramtype zones: list[str] + """ super(CapacityReservationGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.capacity_reservations = None @@ -885,6 +1076,8 @@ def __init__( self, **kwargs ): + """ + """ super(CapacityReservationGroupInstanceView, self).__init__(**kwargs) self.capacity_reservations = None @@ -894,11 +1087,11 @@ class CapacityReservationGroupListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of capacity reservation groups. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroup] - :param next_link: The URI to fetch the next page of capacity reservation groups. Call - ListNext() with this URI to fetch the next page of capacity reservation groups. - :type next_link: str + :ivar value: Required. The list of capacity reservation groups. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroup] + :ivar next_link: The URI to fetch the next page of capacity reservation groups. Call ListNext() + with this URI to fetch the next page of capacity reservation groups. + :vartype next_link: str """ _validation = { @@ -917,6 +1110,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of capacity reservation groups. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroup] + :keyword next_link: The URI to fetch the next page of capacity reservation groups. Call + ListNext() with this URI to fetch the next page of capacity reservation groups. + :paramtype next_link: str + """ super(CapacityReservationGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -927,8 +1127,8 @@ class CapacityReservationGroupUpdate(UpdateResource): 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] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to capacity reservation group. :vartype capacity_reservations: @@ -962,6 +1162,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(CapacityReservationGroupUpdate, self).__init__(tags=tags, **kwargs) self.capacity_reservations = None self.virtual_machines_associated = None @@ -971,10 +1175,11 @@ def __init__( class CapacityReservationInstanceView(msrest.serialization.Model): """The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar utilization_info: Unutilized capacity of the capacity reservation. + :vartype utilization_info: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -989,6 +1194,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword utilization_info: Unutilized capacity of the capacity reservation. + :paramtype utilization_info: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(CapacityReservationInstanceView, self).__init__(**kwargs) self.utilization_info = utilization_info self.statuses = statuses @@ -999,10 +1211,11 @@ class CapacityReservationInstanceViewWithName(CapacityReservationInstanceView): Variables are only populated by the server, and will be ignored when sending a request. - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar utilization_info: Unutilized capacity of the capacity reservation. + :vartype utilization_info: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] :ivar name: The name of the capacity reservation. :vartype name: str """ @@ -1024,6 +1237,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword utilization_info: Unutilized capacity of the capacity reservation. + :paramtype utilization_info: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUtilization + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(CapacityReservationInstanceViewWithName, self).__init__(utilization_info=utilization_info, statuses=statuses, **kwargs) self.name = None @@ -1033,11 +1253,11 @@ class CapacityReservationListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of capacity reservations. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] - :param next_link: The URI to fetch the next page of capacity reservations. Call ListNext() with + :ivar value: Required. The list of capacity reservations. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] + :ivar next_link: The URI to fetch the next page of capacity reservations. Call ListNext() with this URI to fetch the next page of capacity reservations. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1056,6 +1276,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of capacity reservations. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] + :keyword next_link: The URI to fetch the next page of capacity reservations. Call ListNext() + with this URI to fetch the next page of capacity reservations. + :paramtype next_link: str + """ super(CapacityReservationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1064,11 +1291,11 @@ def __init__( class CapacityReservationProfile(msrest.serialization.Model): """The parameters of a capacity reservation Profile. - :param capacity_reservation_group: Specifies the capacity reservation group resource id that + :ivar capacity_reservation_group: Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset vm instances provided enough capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more details. - :type capacity_reservation_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :vartype capacity_reservation_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource """ _attribute_map = { @@ -1081,6 +1308,13 @@ def __init__( capacity_reservation_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword capacity_reservation_group: Specifies the capacity reservation group resource id that + should be used for allocating the virtual machine or scaleset vm instances provided enough + capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more + details. + :paramtype capacity_reservation_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + """ super(CapacityReservationProfile, self).__init__(**kwargs) self.capacity_reservation_group = capacity_reservation_group @@ -1090,14 +1324,14 @@ class CapacityReservationUpdate(UpdateResource): 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 resource for which capacity needs be reserved. The SKU name and capacity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. :vartype reservation_id: str @@ -1138,6 +1372,16 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: SKU of the resource for which capacity needs be reserved. The SKU name and + capacity is required to be set. Currently VM Skus with the capability called + 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs + in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported + values. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + """ super(CapacityReservationUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.reservation_id = None @@ -1170,6 +1414,8 @@ def __init__( self, **kwargs ): + """ + """ super(CapacityReservationUtilization, self).__init__(**kwargs) self.virtual_machines_allocated = None @@ -1195,6 +1441,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -1240,6 +1488,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -1256,35 +1506,35 @@ class CreationData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param create_option: Required. This enumerates the possible sources of a disk's creation. + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", "CopyStart". - :type create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOption - :param storage_account_id: Required if createOption is Import. The Azure Resource Manager + :vartype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference - :param gallery_image_reference: Required if creating from a Gallery Image. The id of the + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. - :type gallery_image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to be imported into a + :vartype gallery_image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot - or disk. - :type source_resource_id: str + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str :ivar source_unique_id: If this field is set, this is the unique id identifying the source of this resource. :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of the contents of the + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - :param logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are + :vartype upload_size_bytes: long + :ivar logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default. - :type logical_sector_size: int + :vartype logical_sector_size: int """ _validation = { @@ -1317,6 +1567,34 @@ def __init__( logical_sector_size: Optional[int] = None, **kwargs ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", + "CopyStart". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference + :keyword gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :paramtype gallery_image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + :keyword logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values + are 512 ad 4096. 4096 is the default. + :paramtype logical_sector_size: int + """ super(CreationData, self).__init__(**kwargs) self.create_option = create_option self.storage_account_id = storage_account_id @@ -1336,44 +1614,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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_04_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :ivar 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_04_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :ivar 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_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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_04_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :ivar 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_04_01.models.ManagedDiskParameters - :param to_be_detached: Specifies whether the data disk is in process of detachment from the + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype 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. @@ -1382,7 +1660,7 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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 @@ -1392,13 +1670,13 @@ class DataDisk(msrest.serialization.Model): 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_04_01.models.DiskDetachOptionTypes - :param delete_option: Specifies whether data disk should be deleted or detached upon VM + :vartype detach_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDetachOptionTypes + :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` The default value is set to **detach**. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes """ _validation = { @@ -1442,6 +1720,63 @@ def __init__( delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + :keyword 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". + :paramtype detach_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDetachOptionTypes + :keyword delete_option: Specifies whether data disk should be deleted or detached upon VM + deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** + If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` + The default value is set to **detach**. Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -1481,6 +1816,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -1498,29 +1835,29 @@ class DedicatedHost(Resource): :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_04_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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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_04_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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_04_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2021_04_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. @@ -1571,6 +1908,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2021_04_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -1586,11 +1945,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -1605,6 +1964,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -1613,9 +1979,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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_04_01.models.DedicatedHostAllocatableVM] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1628,6 +1995,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1645,27 +2018,27 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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_04_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_04_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1701,6 +2074,24 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1712,8 +2103,8 @@ def __init__( 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_04_01.models.DedicatedHostInstanceViewWithName] + :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostInstanceViewWithName] """ _attribute_map = { @@ -1726,6 +2117,11 @@ def __init__( hosts: Optional[List["DedicatedHostInstanceViewWithName"]] = None, **kwargs ): + """ + :keyword hosts: List of instance view of the dedicated hosts under the dedicated host group. + :paramtype hosts: + list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostInstanceViewWithName] + """ super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) self.hosts = hosts @@ -1735,11 +2131,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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_04_01.models.DedicatedHostGroup] - :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1758,6 +2154,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1768,25 +2171,25 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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_04_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_04_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1813,6 +2216,22 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1829,10 +2248,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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_04_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2021_04_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ _validation = { @@ -1852,6 +2272,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2021_04_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -1866,10 +2293,11 @@ class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): :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_04_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2021_04_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] :ivar name: The name of the dedicated host. :vartype name: str """ @@ -1893,6 +2321,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2021_04_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceViewWithName, self).__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) self.name = None @@ -1902,11 +2337,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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_04_01.models.DedicatedHost] - :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1925,6 +2360,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1935,24 +2377,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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_04_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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_04_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2021_04_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. @@ -1991,6 +2433,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2021_04_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -2005,11 +2464,11 @@ def __init__( 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 + :ivar 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_04_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_04_01.models.BootDiagnostics """ _attribute_map = { @@ -2022,6 +2481,13 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_04_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -2029,10 +2495,10 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2021_04_01.models.DiffDiskOptions - :param placement: Specifies the ephemeral disk placement for operating system + :vartype option: str or ~azure.mgmt.compute.v2021_04_01.models.DiffDiskOptions + :ivar 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:`
    ` @@ -2040,7 +2506,7 @@ class DiffDiskSettings(msrest.serialization.Model): https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/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_04_01.models.DiffDiskPlacement + :vartype placement: str or ~azure.mgmt.compute.v2021_04_01.models.DiffDiskPlacement """ _attribute_map = { @@ -2055,6 +2521,20 @@ def __init__( placement: Optional[Union[str, "DiffDiskPlacement"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2021_04_01.models.DiffDiskOptions + :keyword 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/azure/virtual-machines/windows/sizes and Linux VM at + https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a + cache disk. Possible values include: "CacheDisk", "ResourceDisk". + :paramtype placement: str or ~azure.mgmt.compute.v2021_04_01.models.DiffDiskPlacement + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option self.placement = placement @@ -2063,9 +2543,9 @@ def __init__( 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", + :ivar vm_disk_type: VM disk types which are disallowed. Possible values include: "None", "Unmanaged". - :type vm_disk_type: str or ~azure.mgmt.compute.v2021_04_01.models.VmDiskTypes + :vartype vm_disk_type: str or ~azure.mgmt.compute.v2021_04_01.models.VmDiskTypes """ _attribute_map = { @@ -2078,6 +2558,11 @@ def __init__( vm_disk_type: Optional[Union[str, "VmDiskTypes"]] = None, **kwargs ): + """ + :keyword vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :paramtype vm_disk_type: str or ~azure.mgmt.compute.v2021_04_01.models.VmDiskTypes + """ super(DisallowedConfiguration, self).__init__(**kwargs) self.vm_disk_type = vm_disk_type @@ -2095,107 +2580,109 @@ class Disk(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype managed_by_extended: list[str] - :param sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :param extended_location: The extended location where the disk will be created. Extended + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, or StandardSSD_ZRS. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] + :ivar extended_location: The extended location where the disk will be created. Extended location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation :ivar time_created: The time when the disk was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities for the image from which the OS + :vartype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :ivar supported_capabilities: List of supported capabilities for the image from which the OS disk was created. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used for Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long + :vartype disk_m_bps_read_only: long :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", "ActiveUpload". :vartype disk_state: str or ~azure.mgmt.compute.v2021_04_01.models.DiskState - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. :vartype share_info: list[~azure.mgmt.compute.v2021_04_01.models.ShareInfoElement] - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool + :vartype bursting_enabled: bool :ivar property_updates_in_progress: Properties of the disk for which update is pending. :vartype property_updates_in_progress: ~azure.mgmt.compute.v2021_04_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param security_profile: Contains the security related information for the resource. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityProfile - :param completion_percent: Percentage complete for the background copy when a resource is + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar security_profile: Contains the security related information for the resource. + :vartype security_profile: ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityProfile + :ivar completion_percent: Percentage complete for the background copy when a resource is created via the CopyStart operation. - :type completion_percent: float - :param public_network_access: Policy for controlling export on the disk. Possible values + :vartype completion_percent: float + :ivar public_network_access: Policy for controlling export on the disk. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess """ _validation = { @@ -2286,6 +2773,89 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword extended_location: The extended location where the disk will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + WindowsServer}. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :keyword supported_capabilities: List of supported capabilities for the image from which the OS + disk was created. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + :keyword security_profile: Contains the security related information for the resource. + :paramtype security_profile: ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityProfile + :keyword completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :paramtype completion_percent: float + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + """ super(Disk, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.managed_by_extended = None @@ -2335,13 +2905,13 @@ class DiskAccess(Resource): :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 where the disk access will be created. Extended + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location where the disk access will be created. Extended location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation :ivar private_endpoint_connections: A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. :vartype private_endpoint_connections: @@ -2382,6 +2952,15 @@ def __init__( extended_location: Optional["ExtendedLocation"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location where the disk access will be created. + Extended location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + """ super(DiskAccess, self).__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location self.private_endpoint_connections = None @@ -2394,11 +2973,11 @@ class DiskAccessList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk access resources. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] - :param next_link: The uri to fetch the next page of disk access resources. Call ListNext() with + :ivar value: Required. A list of disk access resources. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] + :ivar next_link: The uri to fetch the next page of disk access resources. Call ListNext() with this to fetch the next page of disk access resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2417,6 +2996,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk access resources. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] + :keyword next_link: The uri to fetch the next page of disk access resources. Call ListNext() + with this to fetch the next page of disk access resources. + :paramtype next_link: str + """ super(DiskAccessList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2425,8 +3011,8 @@ def __init__( class DiskAccessUpdate(msrest.serialization.Model): """Used for updating a disk access resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -2439,6 +3025,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DiskAccessUpdate, self).__init__(**kwargs) self.tags = tags @@ -2456,27 +3046,27 @@ class DiskEncryptionSet(Resource): :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 identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType - :param active_key: The key vault key which is currently used by this disk encryption set. - :type active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet + :vartype encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet :ivar previous_keys: A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. :vartype previous_keys: list[~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet] :ivar provisioning_state: The disk encryption set provisioning state. :vartype provisioning_state: str - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool + :vartype rotation_to_latest_key_version_enabled: bool :ivar last_key_rotation_timestamp: The time when the active key of this disk encryption set was updated. :vartype last_key_rotation_timestamp: ~datetime.datetime @@ -2524,6 +3114,23 @@ def __init__( rotation_to_latest_key_version_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet + :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating + of this disk encryption set to the latest key version. + :paramtype rotation_to_latest_key_version_enabled: bool + """ super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.encryption_type = encryption_type @@ -2540,11 +3147,11 @@ class DiskEncryptionSetList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk encryption sets. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] - :param next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2563,6 +3170,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ super(DiskEncryptionSetList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2571,8 +3185,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2585,6 +3199,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -2592,8 +3210,8 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2606,19 +3224,23 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ 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 + :ivar 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_04_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_04_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -2635,6 +3257,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -2644,20 +3275,20 @@ def __init__( class DiskEncryptionSetUpdate(msrest.serialization.Model): """disk encryption set update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The managed identity for the disk encryption set. It should be given - permission on the key vault before it can be used to encrypt disks. - :type identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity - :param encryption_type: The type of key used to encrypt the data of the disk. Possible values + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType - :param active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and + :vartype encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType + :ivar active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. - :type active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet - :param rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + :vartype active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. - :type rotation_to_latest_key_version_enabled: bool + :vartype rotation_to_latest_key_version_enabled: bool """ _attribute_map = { @@ -2678,6 +3309,22 @@ def __init__( rotation_to_latest_key_version_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetType + :keyword active_key: Key Vault Key Url to be used for server side encryption of Managed Disks + and Snapshots. + :paramtype active_key: ~azure.mgmt.compute.v2021_04_01.models.KeyForDiskEncryptionSet + :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating + of this disk encryption set to the latest key version. + :paramtype rotation_to_latest_key_version_enabled: bool + """ super(DiskEncryptionSetUpdate, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -2689,13 +3336,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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_04_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -2712,6 +3360,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -2723,11 +3381,11 @@ class DiskList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disks. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.Disk] - :param next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2746,6 +3404,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ super(DiskList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2780,6 +3445,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -2803,15 +3470,15 @@ class DiskRestorePoint(ProxyOnlyResource): :vartype source_resource_id: str :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the the image from which the OS disk was + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities (like accelerated networking) for + :vartype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :ivar supported_capabilities: List of supported capabilities (like accelerated networking) for the image from which the OS disk was created. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities :ivar family_id: id of the backing snapshot's MIS family. :vartype family_id: str :ivar source_unique_id: unique incarnation id of the source disk. @@ -2819,19 +3486,21 @@ class DiskRestorePoint(ProxyOnlyResource): :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. :vartype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param public_network_access: Policy for controlling export on the disk. Possible values + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :ivar public_network_access: Policy for controlling export on the disk. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param completion_percent: Percentage complete for the background copy when a resource is + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar completion_percent: Percentage complete for the background copy when a resource is created via the CopyStart operation. - :type completion_percent: float + :vartype completion_percent: float """ _validation = { @@ -2879,6 +3548,33 @@ def __init__( completion_percent: Optional[float] = None, **kwargs ): + """ + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :keyword supported_capabilities: List of supported capabilities (like accelerated networking) + for the image from which the OS disk was created. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :paramtype completion_percent: float + """ super(DiskRestorePoint, self).__init__(**kwargs) self.time_created = None self.source_resource_id = None @@ -2901,11 +3597,11 @@ class DiskRestorePointList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of disk restore points. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePoint] - :param next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + :ivar value: Required. A list of disk restore points. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePoint] + :ivar next_link: The uri to fetch the next page of disk restore points. Call ListNext() with this to fetch the next page of disk restore points. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2924,6 +3620,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of disk restore points. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePoint] + :keyword next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + this to fetch the next page of disk restore points. + :paramtype next_link: str + """ super(DiskRestorePointList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2932,9 +3635,9 @@ def __init__( class DiskSecurityProfile(msrest.serialization.Model): """Contains the security related information for the resource. - :param security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. + :ivar security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityTypes + :vartype security_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityTypes """ _attribute_map = { @@ -2947,6 +3650,11 @@ def __init__( security_type: Optional[Union[str, "DiskSecurityTypes"]] = None, **kwargs ): + """ + :keyword security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. + Possible values include: "TrustedLaunch". + :paramtype security_type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskSecurityTypes + """ super(DiskSecurityProfile, self).__init__(**kwargs) self.security_type = security_type @@ -2956,9 +3664,9 @@ class DiskSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". - :type name: str or ~azure.mgmt.compute.v2021_04_01.models.DiskStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2021_04_01.models.DiskStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -2978,6 +3686,11 @@ def __init__( name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2021_04_01.models.DiskStorageAccountTypes + """ super(DiskSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -2988,67 +3701,69 @@ class DiskUpdate(msrest.serialization.Model): 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: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, - UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, or StandardSSD_ZRS. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_write: long - :param disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_write: long - :param disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. - :type disk_iops_read_only: long - :param disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - :type disk_m_bps_read_only: long - :param max_shares: The maximum number of VMs that can attach to the disk at the same time. - Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. - :type max_shares: int - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype disk_m_bps_read_only: long + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param tier: Performance tier of the disk (e.g, P4, S10) as described here: + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. - :type tier: str - :param bursting_enabled: Set to true to enable bursting beyond the provisioned performance + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. - :type bursting_enabled: bool - :param purchase_plan: Purchase plan information to be added on the OS disk. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities (like accelerated networking) to + :vartype bursting_enabled: bool + :ivar purchase_plan: Purchase plan information to be added on the OS disk. + :vartype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :ivar supported_capabilities: List of supported capabilities (like accelerated networking) to be added on the OS disk. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities :ivar property_updates_in_progress: Properties of the disk for which update is pending. :vartype property_updates_in_progress: ~azure.mgmt.compute.v2021_04_01.models.PropertyUpdatesInProgress - :param supports_hibernation: Indicates the OS on a disk supports hibernation. - :type supports_hibernation: bool - :param public_network_access: Policy for controlling export on the disk. Possible values + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess """ _validation = { @@ -3102,6 +3817,69 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + :keyword purchase_plan: Purchase plan information to be added on the OS disk. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :keyword supported_capabilities: List of supported capabilities (like accelerated networking) + to be added on the OS disk. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + """ super(DiskUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -3128,13 +3906,13 @@ def __init__( class Encryption(msrest.serialization.Model): """Encryption at rest settings for disk or snapshot. - :param disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling encryption at rest. - :type disk_encryption_set_id: str - :param type: The type of key used to encrypt the data of the disk. Possible values include: + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Possible values include: "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys". - :type type: str or ~azure.mgmt.compute.v2021_04_01.models.EncryptionType + :vartype type: str or ~azure.mgmt.compute.v2021_04_01.models.EncryptionType """ _attribute_map = { @@ -3149,6 +3927,15 @@ def __init__( type: Optional[Union[str, "EncryptionType"]] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype type: str or ~azure.mgmt.compute.v2021_04_01.models.EncryptionType + """ super(Encryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id self.type = type @@ -3159,11 +3946,11 @@ class EncryptionSetIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetIdentityType + :vartype type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetIdentityType :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity. @@ -3191,6 +3978,14 @@ def __init__( type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported for new creations. Disk Encryption Sets can be updated with Identity type None + during migration of subscription to a new Azure Active Directory tenant; it will cause the + encrypted resources to lose access to the keys. Possible values include: "SystemAssigned", + "None". + :paramtype type: str or ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetIdentityType + """ super(EncryptionSetIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -3202,18 +3997,18 @@ class EncryptionSettingsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for each disk volume. - :type encryption_settings: + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: list[~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is used for the disks. + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - :type encryption_settings_version: str + :vartype encryption_settings_version: str """ _validation = { @@ -3234,6 +4029,20 @@ def __init__( encryption_settings_version: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ super(EncryptionSettingsCollection, self).__init__(**kwargs) self.enabled = enabled self.encryption_settings = encryption_settings @@ -3243,11 +4052,11 @@ def __init__( class EncryptionSettingsElement(msrest.serialization.Model): """Encryption settings for one disk volume. - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. - :type disk_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - :type key_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndKeyReference + :vartype key_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndKeyReference """ _attribute_map = { @@ -3262,6 +4071,14 @@ def __init__( key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, **kwargs ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2021_04_01.models.KeyVaultAndKeyReference + """ super(EncryptionSettingsElement, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -3270,10 +4087,10 @@ def __init__( 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_04_01.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -3288,6 +4105,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -3298,10 +4121,10 @@ class GrantAccessData(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access: Required. Possible values include: "None", "Read", "Write". - :type access: str or ~azure.mgmt.compute.v2021_04_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the SAS access expires. - :type duration_in_seconds: int + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2021_04_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int """ _validation = { @@ -3321,6 +4144,12 @@ def __init__( duration_in_seconds: int, **kwargs ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2021_04_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + """ super(GrantAccessData, self).__init__(**kwargs) self.access = access self.duration_in_seconds = duration_in_seconds @@ -3329,7 +4158,7 @@ def __init__( 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 + :ivar 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 @@ -3375,7 +4204,7 @@ class HardwareProfile(msrest.serialization.Model): "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_04_01.models.VirtualMachineSizeTypes + :vartype vm_size: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeTypes """ _attribute_map = { @@ -3388,6 +4217,55 @@ def __init__( vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeTypes + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -3405,24 +4283,25 @@ class Image(Resource): :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_04_01.models.ExtendedLocation - :param source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Image. + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_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_04_01.models.HyperVGenerationTypes + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationTypes """ _validation = { @@ -3457,6 +4336,25 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Image. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location self.source_virtual_machine = source_virtual_machine @@ -3468,30 +4366,32 @@ def __init__( class ImageDisk(msrest.serialization.Model): """Describes a image disk. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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_04_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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_04_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :ivar 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_04_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -3516,6 +4416,34 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + """ super(ImageDisk, self).__init__(**kwargs) self.snapshot = snapshot self.managed_disk = managed_disk @@ -3531,34 +4459,36 @@ class ImageDataDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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_04_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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_04_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :ivar 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_04_01.models.DiskEncryptionSetParameters - :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype lun: int """ _validation = { @@ -3589,6 +4519,38 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + :keyword 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. + :paramtype lun: int + """ 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 @@ -3598,12 +4560,12 @@ class ImageDiskReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A relative uri containing either a Platform Image Repository or user image + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an index that indicates + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - :type lun: int + :vartype lun: int """ _validation = { @@ -3622,6 +4584,14 @@ def __init__( lun: Optional[int] = None, **kwargs ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ super(ImageDiskReference, self).__init__(**kwargs) self.id = id self.lun = lun @@ -3632,11 +4602,11 @@ class ImageListResult(msrest.serialization.Model): 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_04_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -3655,6 +4625,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3665,37 +4642,39 @@ class ImageOSDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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_04_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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_04_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :ivar 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_04_01.models.DiskEncryptionSetParameters - :param os_type: Required. This property allows you to specify the type of the OS that is + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + :ivar 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_04_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemStateTypes + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemStateTypes """ _validation = { @@ -3729,6 +4708,42 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemStateTypes + """ 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 @@ -3739,21 +4754,21 @@ class ImageReference(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype 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'. @@ -3783,6 +4798,23 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -3794,19 +4826,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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_04_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2021_04_01.models.ImageOSDisk + :ivar 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_04_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2021_04_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -3823,6 +4855,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_04_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2021_04_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -3834,20 +4881,21 @@ class ImageUpdate(UpdateResource): 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_04_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_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_04_01.models.HyperVGenerationTypes + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationTypes """ _validation = { @@ -3871,6 +4919,21 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -3881,10 +4944,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -3899,6 +4962,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -3907,16 +4976,16 @@ def __init__( 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_04_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2021_04_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -3937,6 +5006,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2021_04_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -3950,13 +5031,13 @@ class KeyForDiskEncryptionSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Resource id of the KeyVault containing the key or secret. This property is + :ivar source_vault: Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. - :type source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault - :param key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version - segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. - :type key_url: str + :vartype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault + :ivar key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version segment + of the Url is required regardless of rotationToLatestKeyVersionEnabled value. + :vartype key_url: str """ _validation = { @@ -3975,6 +5056,15 @@ def __init__( source_vault: Optional["SourceVault"] = None, **kwargs ): + """ + :keyword source_vault: Resource id of the KeyVault containing the key or secret. This property + is optional and cannot be used if the KeyVault subscription is not the same as the Disk + Encryption Set subscription. + :paramtype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault + :keyword key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version + segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. + :paramtype key_url: str + """ super(KeyForDiskEncryptionSet, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -3985,10 +5075,10 @@ class KeyVaultAndKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault. - :type key_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str """ _validation = { @@ -4008,6 +5098,12 @@ def __init__( key_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ super(KeyVaultAndKeyReference, self).__init__(**kwargs) self.source_vault = source_vault self.key_url = key_url @@ -4018,10 +5114,10 @@ class KeyVaultAndSecretReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. Resource id of the KeyVault containing the key or secret. - :type source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault. - :type secret_url: str + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str """ _validation = { @@ -4041,6 +5137,12 @@ def __init__( secret_url: str, **kwargs ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ super(KeyVaultAndSecretReference, self).__init__(**kwargs) self.source_vault = source_vault self.secret_url = secret_url @@ -4051,10 +5153,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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_04_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SubResource """ _validation = { @@ -4074,6 +5176,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -4084,10 +5192,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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_04_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SubResource """ _validation = { @@ -4107,6 +5215,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -4182,6 +5296,8 @@ def __init__( self, **kwargs ): + """ + """ super(LastPatchInstallationSummary, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -4199,19 +5315,19 @@ def __init__( 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 `_. - :param disable_password_authentication: Specifies whether password authentication should be + :ivar 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_04_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2021_04_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. - :type patch_settings: ~azure.mgmt.compute.v2021_04_01.models.LinuxPatchSettings + :vartype patch_settings: ~azure.mgmt.compute.v2021_04_01.models.LinuxPatchSettings """ _attribute_map = { @@ -4230,6 +5346,21 @@ def __init__( patch_settings: Optional["LinuxPatchSettings"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2021_04_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :paramtype patch_settings: ~azure.mgmt.compute.v2021_04_01.models.LinuxPatchSettings + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -4240,19 +5371,19 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Linux. - :type classifications_to_include: list[str or + :vartype classifications_to_include: list[str or ~azure.mgmt.compute.v2021_04_01.models.VMGuestPatchClassificationLinux] - :param package_name_masks_to_include: packages to include in the patch operation. Format: + :ivar 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: + :vartype package_name_masks_to_include: list[str] + :ivar 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 + :vartype package_name_masks_to_exclude: list[str] + :ivar maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest Patching in Linux. - :type maintenance_run_id: str + :vartype maintenance_run_id: str """ _attribute_map = { @@ -4271,6 +5402,21 @@ def __init__( maintenance_run_id: Optional[str] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Linux. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_04_01.models.VMGuestPatchClassificationLinux] + :keyword package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_include: list[str] + :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_exclude: list[str] + :keyword maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :paramtype maintenance_run_id: str + """ super(LinuxParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.package_name_masks_to_include = package_name_masks_to_include @@ -4281,21 +5427,22 @@ def __init__( 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 or virtual + :ivar patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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_04_01.models.LinuxVMGuestPatchMode - :param assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + :vartype patch_mode: str or ~azure.mgmt.compute.v2021_04_01.models.LinuxVMGuestPatchMode + :ivar assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. Possible values include: "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_04_01.models.LinuxPatchAssessmentMode + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2021_04_01.models.LinuxPatchAssessmentMode """ _attribute_map = { @@ -4310,6 +5457,24 @@ def __init__( assessment_mode: Optional[Union[str, "LinuxPatchAssessmentMode"]] = None, **kwargs ): + """ + :keyword patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2021_04_01.models.LinuxVMGuestPatchMode + :keyword assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` + **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2021_04_01.models.LinuxPatchAssessmentMode + """ super(LinuxPatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode self.assessment_mode = assessment_mode @@ -4320,11 +5485,11 @@ class ListUsagesResult(msrest.serialization.Model): 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_04_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4343,6 +5508,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4353,23 +5525,23 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -4402,6 +5574,25 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -4434,6 +5625,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -4459,6 +5652,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -4466,23 +5661,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2021_04_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -4507,6 +5702,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2021_04_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -4520,16 +5734,18 @@ def __init__( 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: + :ivar id: Resource Id. + :vartype id: str + :ivar 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_04_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -4546,6 +5762,20 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -4554,14 +5784,14 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions """ _attribute_map = { @@ -4578,6 +5808,16 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary self.delete_option = delete_option @@ -4586,17 +5826,17 @@ def __init__( class NetworkProfile(msrest.serialization.Model): """Specifies the network interfaces or the networking configuration of the virtual machine. - :param network_interfaces: Specifies the list of resource Ids for the network interfaces + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2021_04_01.models.NetworkInterfaceReference] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion - :param network_interface_configurations: Specifies the networking configurations that will be + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion + :ivar network_interface_configurations: Specifies the networking configurations that will be used to create the virtual machine networking resources. - :type network_interface_configurations: + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceConfiguration] """ @@ -4614,6 +5854,20 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineNetworkInterfaceConfiguration"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2021_04_01.models.NetworkInterfaceReference] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations. Possible values include: + "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion + :keyword network_interface_configurations: Specifies the networking configurations that will be + used to create the virtual machine networking resources. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceConfiguration] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces self.network_api_version = network_api_version @@ -4625,12 +5879,12 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_name: Required. The name of the service. Possible values include: + :ivar service_name: Required. The name of the service. Possible values include: "AutomaticRepairs", "DummyOrchestrationServiceName". - :type service_name: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", + :vartype service_name: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceNames + :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". - :type action: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceStateAction + :vartype action: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceStateAction """ _validation = { @@ -4650,6 +5904,16 @@ def __init__( action: Union[str, "OrchestrationServiceStateAction"], **kwargs ): + """ + :keyword service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :paramtype service_name: str or + ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceNames + :keyword action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :paramtype action: str or + ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceStateAction + """ super(OrchestrationServiceStateInput, self).__init__(**kwargs) self.service_name = service_name self.action = action @@ -4682,6 +5946,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrchestrationServiceSummary, self).__init__(**kwargs) self.service_name = None self.service_state = None @@ -4692,56 +5958,56 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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_04_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar 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_04_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :ivar 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_04_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :ivar 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_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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_04_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2021_04_01.models.DiffDiskSettings + :ivar 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_04_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :ivar 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_04_01.models.ManagedDiskParameters - :param delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The default value is set to **detach**. For an ephemeral OS Disk, the default value is set to **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes """ _validation = { @@ -4780,6 +6046,58 @@ def __init__( delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2021_04_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :keyword delete_option: Specifies whether OS Disk should be deleted or detached upon VM + deletion. :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If + this value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The + default value is set to **detach**. For an ephemeral OS Disk, the default value is set to + **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values + include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskDeleteOptionTypes + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -4800,9 +6118,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes """ _validation = { @@ -4819,6 +6137,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -4826,25 +6149,24 @@ def __init__( 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. + :ivar 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. - :type admin_username: str - :param admin_password: Specifies the password of the administrator account. + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -4858,8 +6180,8 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 @@ -4869,30 +6191,30 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration + :ivar 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 `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. To install certificates on a virtual machine it is recommended to use the `Azure Key - Vault virtual machine extension for Linux + :vartype linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + To install certificates on a virtual machine it is recommended to use the `Azure Key Vault + virtual machine extension for Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar 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 + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -4921,6 +6243,75 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. To install certificates on a virtual machine it is recommended to use the `Azure Key + Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword 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.**. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -4978,6 +6369,8 @@ def __init__( self, **kwargs ): + """ + """ super(PatchInstallationDetail, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -4990,7 +6383,7 @@ def __init__( 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 or virtual + :ivar patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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 @@ -5001,18 +6394,19 @@ class PatchSettings(msrest.serialization.Model): **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_04_01.models.WindowsVMGuestPatchMode - :param enable_hotpatching: Enables customers to patch their Azure VMs without requiring a + :vartype patch_mode: str or ~azure.mgmt.compute.v2021_04_01.models.WindowsVMGuestPatchMode + :ivar 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 - :param assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual + :vartype enable_hotpatching: bool + :ivar assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. Possible values include: "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_04_01.models.WindowsPatchAssessmentMode + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2021_04_01.models.WindowsPatchAssessmentMode """ _attribute_map = { @@ -5029,6 +6423,32 @@ def __init__( assessment_mode: Optional[Union[str, "WindowsPatchAssessmentMode"]] = None, **kwargs ): + """ + :keyword patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2021_04_01.models.WindowsVMGuestPatchMode + :keyword 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'. + :paramtype enable_hotpatching: bool + :keyword assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual + machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` + **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2021_04_01.models.WindowsPatchAssessmentMode + """ super(PatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode self.enable_hotpatching = enable_hotpatching @@ -5038,15 +6458,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -5065,6 +6485,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -5093,6 +6524,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -5110,9 +6543,9 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype type: str :ivar private_endpoint: The resource of private end point. :vartype private_endpoint: ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between DiskAccess and Virtual Network. - :type private_link_service_connection_state: + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between DiskAccess and Virtual Network. + :vartype private_link_service_connection_state: ~azure.mgmt.compute.v2021_04_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -5143,6 +6576,12 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between DiskAccess and Virtual Network. + :paramtype private_link_service_connection_state: + ~azure.mgmt.compute.v2021_04_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.id = None self.name = None @@ -5155,11 +6594,11 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -5174,6 +6613,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5194,8 +6640,8 @@ class PrivateLinkResource(msrest.serialization.Model): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -5221,6 +6667,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = None self.name = None @@ -5233,8 +6683,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateLinkResource] """ _attribute_map = { @@ -5247,6 +6697,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -5254,15 +6708,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -5279,6 +6733,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -5288,9 +6753,9 @@ def __init__( class PropertyUpdatesInProgress(msrest.serialization.Model): """Properties of the disk for which update is pending. - :param target_tier: The target performance tier of the disk if a tier change operation is in + :ivar target_tier: The target performance tier of the disk if a tier change operation is in progress. - :type target_tier: str + :vartype target_tier: str """ _attribute_map = { @@ -5303,6 +6768,11 @@ def __init__( target_tier: Optional[str] = None, **kwargs ): + """ + :keyword target_tier: The target performance tier of the disk if a tier change operation is in + progress. + :paramtype target_tier: str + """ super(PropertyUpdatesInProgress, self).__init__(**kwargs) self.target_tier = target_tier @@ -5320,15 +6790,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -5342,8 +6812,8 @@ class ProximityPlacementGroup(Resource): placement group. :vartype availability_sets: list[~azure.mgmt.compute.v2021_04_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus """ _validation = { @@ -5378,6 +6848,20 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -5391,10 +6875,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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_04_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -5413,6 +6897,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5421,8 +6911,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -5435,6 +6925,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -5467,6 +6961,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -5476,10 +6972,10 @@ def __init__( class PublicIPAddressSku(msrest.serialization.Model): """Describes the public IP Sku. - :param name: Specify public IP sku name. Possible values include: "Basic", "Standard". - :type name: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuName - :param tier: Specify public IP sku tier. Possible values include: "Regional", "Global". - :type tier: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuTier + :ivar name: Specify public IP sku name. Possible values include: "Basic", "Standard". + :vartype name: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuName + :ivar tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :vartype tier: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuTier """ _attribute_map = { @@ -5494,6 +6990,12 @@ def __init__( tier: Optional[Union[str, "PublicIPAddressSkuTier"]] = None, **kwargs ): + """ + :keyword name: Specify public IP sku name. Possible values include: "Basic", "Standard". + :paramtype name: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuName + :keyword tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :paramtype tier: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSkuTier + """ super(PublicIPAddressSku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5504,13 +7006,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -5533,6 +7035,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -5544,15 +7055,15 @@ class PurchasePlanAutoGenerated(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The plan ID. - :type name: str - :param publisher: Required. The publisher ID. - :type publisher: str - :param product: Required. Specifies the product of the image from the marketplace. This is the + :ivar name: Required. The plan ID. + :vartype name: str + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar 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 - :param promotion_code: The Offer Promotion Code. - :type promotion_code: str + :vartype product: str + :ivar promotion_code: The Offer Promotion Code. + :vartype promotion_code: str """ _validation = { @@ -5577,6 +7088,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The Offer Promotion Code. + :paramtype promotion_code: str + """ super(PurchasePlanAutoGenerated, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -5610,6 +7132,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -5620,26 +7144,26 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool + :ivar 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_04_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2021_04_01.models.IntervalInMins """ _validation = { @@ -5675,6 +7199,28 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2021_04_01.models.IntervalInMins + """ 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 @@ -5684,12 +7230,12 @@ class ResourceUriList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + :ivar value: Required. A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. - :type value: list[str] - :param next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + :vartype value: list[str] + :ivar next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -5708,6 +7254,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + disk encryption set. + :paramtype value: list[str] + :keyword next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + this to fetch the next page of encrypted resources. + :paramtype next_link: str + """ super(ResourceUriList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5724,9 +7278,9 @@ class RestorePoint(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param exclude_disks: List of disk resource ids that the customer wishes to exclude from the + :ivar exclude_disks: List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. - :type exclude_disks: list[~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference] + :vartype exclude_disks: list[~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference] :ivar source_metadata: Gets the details of the VM captured at the time of the restore point creation. :vartype source_metadata: ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceMetadata @@ -5736,10 +7290,8 @@ class RestorePoint(ProxyResource): https://aka.ms/RestorePoints for more details. Possible values include: "CrashConsistent", "FileSystemConsistent", "ApplicationConsistent". :vartype consistency_mode: str or ~azure.mgmt.compute.v2021_04_01.models.ConsistencyModeTypes - :ivar provisioning_details: Gets the provisioning details set by the server during Create - restore point operation. - :vartype provisioning_details: - ~azure.mgmt.compute.v2021_04_01.models.RestorePointProvisioningDetails + :ivar time_created: Gets the creation time of the restore point. + :vartype time_created: ~datetime.datetime """ _validation = { @@ -5749,7 +7301,6 @@ class RestorePoint(ProxyResource): 'source_metadata': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'consistency_mode': {'readonly': True}, - 'provisioning_details': {'readonly': True}, } _attribute_map = { @@ -5760,21 +7311,29 @@ class RestorePoint(ProxyResource): 'source_metadata': {'key': 'properties.sourceMetadata', 'type': 'RestorePointSourceMetadata'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'consistency_mode': {'key': 'properties.consistencyMode', 'type': 'str'}, - 'provisioning_details': {'key': 'properties.provisioningDetails', 'type': 'RestorePointProvisioningDetails'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, } def __init__( self, *, exclude_disks: Optional[List["ApiEntityReference"]] = None, + time_created: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword exclude_disks: List of disk resource ids that the customer wishes to exclude from the + restore point. If no disks are specified, all disks will be included. + :paramtype exclude_disks: list[~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference] + :keyword time_created: Gets the creation time of the restore point. + :paramtype time_created: ~datetime.datetime + """ super(RestorePoint, self).__init__(**kwargs) self.exclude_disks = exclude_disks self.source_metadata = None self.provisioning_state = None self.consistency_mode = None - self.provisioning_details = None + self.time_created = time_created class RestorePointCollection(Resource): @@ -5790,13 +7349,13 @@ class RestorePointCollection(Resource): :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 properties of the source resource that this restore point collection is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The properties of the source resource that this restore point collection is created from. - :type source: ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties + :vartype source: ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties :ivar provisioning_state: The provisioning state of the restore point collection. :vartype provisioning_state: str :ivar restore_point_collection_id: The unique id of the restore point collection. @@ -5836,6 +7395,16 @@ def __init__( source: Optional["RestorePointCollectionSourceProperties"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The properties of the source resource that this restore point collection is + created from. + :paramtype source: + ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties + """ super(RestorePointCollection, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.provisioning_state = None @@ -5846,11 +7415,11 @@ def __init__( class RestorePointCollectionListResult(msrest.serialization.Model): """The List restore point collection operation response. - :param value: Gets the list of restore point collections. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollection] - :param next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + :ivar value: Gets the list of restore point collections. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollection] + :ivar next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() with this to fetch the next page of RestorePointCollections. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -5865,6 +7434,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets the list of restore point collections. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollection] + :keyword next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + with this to fetch the next page of RestorePointCollections. + :paramtype next_link: str + """ super(RestorePointCollectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5877,8 +7453,8 @@ class RestorePointCollectionSourceProperties(msrest.serialization.Model): :ivar location: Location of the source resource used to create this restore point collection. :vartype location: str - :param id: Resource Id of the source resource used to create this restore point collection. - :type id: str + :ivar id: Resource Id of the source resource used to create this restore point collection. + :vartype id: str """ _validation = { @@ -5896,6 +7472,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id of the source resource used to create this restore point collection. + :paramtype id: str + """ super(RestorePointCollectionSourceProperties, self).__init__(**kwargs) self.location = None self.id = id @@ -5906,11 +7486,11 @@ class RestorePointCollectionUpdate(UpdateResource): 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 properties of the source resource that this restore point collection is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The properties of the source resource that this restore point collection is created from. - :type source: ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties + :vartype source: ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties :ivar provisioning_state: The provisioning state of the restore point collection. :vartype provisioning_state: str :ivar restore_point_collection_id: The unique id of the restore point collection. @@ -5941,6 +7521,14 @@ def __init__( source: Optional["RestorePointCollectionSourceProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The properties of the source resource that this restore point collection is + created from. + :paramtype source: + ~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionSourceProperties + """ super(RestorePointCollectionUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.provisioning_state = None @@ -5948,63 +7536,26 @@ def __init__( self.restore_points = None -class RestorePointProvisioningDetails(msrest.serialization.Model): - """Restore Point Provisioning details. - - :param creation_time: Gets the creation time of the restore point. - :type creation_time: ~datetime.datetime - :param total_used_size_in_bytes: Gets the total size of the data in all the disks which are - part of the restore point. - :type total_used_size_in_bytes: long - :param status_code: Gets the status of the Create restore point operation. - :type status_code: int - :param status_message: Gets the status message of the Create restore point operation. - :type status_message: str - """ - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'total_used_size_in_bytes': {'key': 'totalUsedSizeInBytes', 'type': 'long'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - } - - def __init__( - self, - *, - creation_time: Optional[datetime.datetime] = None, - total_used_size_in_bytes: Optional[int] = None, - status_code: Optional[int] = None, - status_message: Optional[str] = None, - **kwargs - ): - super(RestorePointProvisioningDetails, self).__init__(**kwargs) - self.creation_time = creation_time - self.total_used_size_in_bytes = total_used_size_in_bytes - self.status_code = status_code - self.status_message = status_message - - class RestorePointSourceMetadata(msrest.serialization.Model): """Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point creation. - :param hardware_profile: Gets the hardware profile. - :type hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile - :param storage_profile: Gets the storage profile. - :type storage_profile: + :ivar hardware_profile: Gets the hardware profile. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :ivar storage_profile: Gets the storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMStorageProfile - :param os_profile: Gets the OS profile. - :type os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile - :param diagnostics_profile: Gets the diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param license_type: Gets the license type, which is for bring your own license scenario. - :type license_type: str - :param vm_id: Gets the virtual machine unique id. - :type vm_id: str - :param security_profile: Gets the security profile. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param location: Location of the VM from which the restore point was created. - :type location: str + :ivar os_profile: Gets the OS profile. + :vartype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :ivar diagnostics_profile: Gets the diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :ivar license_type: Gets the license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar vm_id: Gets the virtual machine unique id. + :vartype vm_id: str + :ivar security_profile: Gets the security profile. + :vartype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :ivar location: Location of the VM from which the restore point was created. + :vartype location: str """ _attribute_map = { @@ -6031,6 +7582,25 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword hardware_profile: Gets the hardware profile. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :keyword storage_profile: Gets the storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMStorageProfile + :keyword os_profile: Gets the OS profile. + :paramtype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :keyword diagnostics_profile: Gets the diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :keyword license_type: Gets the license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword vm_id: Gets the virtual machine unique id. + :paramtype vm_id: str + :keyword security_profile: Gets the security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :keyword location: Location of the VM from which the restore point was created. + :paramtype location: str + """ super(RestorePointSourceMetadata, self).__init__(**kwargs) self.hardware_profile = hardware_profile self.storage_profile = storage_profile @@ -6045,20 +7615,19 @@ def __init__( class RestorePointSourceVMDataDisk(msrest.serialization.Model): """Describes a data disk. - :param lun: Gets the logical unit number. - :type lun: int - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes - :param disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired + :ivar lun: Gets the logical unit number. + :vartype lun: int + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference """ _attribute_map = { @@ -6081,6 +7650,22 @@ def __init__( disk_restore_point: Optional["ApiEntityReference"] = None, **kwargs ): + """ + :keyword lun: Gets the logical unit number. + :paramtype lun: int + :keyword name: Gets the disk name. + :paramtype name: str + :keyword caching: Gets the caching type. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new + desired size for existing OS and Data disks. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + """ super(RestorePointSourceVMDataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -6093,21 +7678,20 @@ def __init__( class RestorePointSourceVMOSDisk(msrest.serialization.Model): """Describes an Operating System disk. - :param os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemType - :param encryption_settings: Gets the disk encryption settings. - :type encryption_settings: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes - :param disk_size_gb: Gets the disk size in GB. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :ivar os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemType + :ivar encryption_settings: Gets the disk encryption settings. + :vartype encryption_settings: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar disk_size_gb: Gets the disk size in GB. + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference """ _attribute_map = { @@ -6132,6 +7716,23 @@ def __init__( disk_restore_point: Optional["ApiEntityReference"] = None, **kwargs ): + """ + :keyword os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemType + :keyword encryption_settings: Gets the disk encryption settings. + :paramtype encryption_settings: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSettings + :keyword name: Gets the disk name. + :paramtype name: str + :keyword caching: Gets the caching type. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword disk_size_gb: Gets the disk size in GB. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + """ super(RestorePointSourceVMOSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -6145,11 +7746,11 @@ def __init__( class RestorePointSourceVMStorageProfile(msrest.serialization.Model): """Describes the storage profile. - :param os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. - :type os_disk: ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMOSDisk - :param data_disks: Gets the data disks of the VM captured at the time of the restore point + :ivar os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. + :vartype os_disk: ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMOSDisk + :ivar data_disks: Gets the data disks of the VM captured at the time of the restore point creation. - :type data_disks: list[~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMDataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMDataDisk] """ _attribute_map = { @@ -6164,6 +7765,15 @@ def __init__( data_disks: Optional[List["RestorePointSourceVMDataDisk"]] = None, **kwargs ): + """ + :keyword os_disk: Gets the OS disk of the VM captured at the time of the restore point + creation. + :paramtype os_disk: ~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMOSDisk + :keyword data_disks: Gets the data disks of the VM captured at the time of the restore point + creation. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_04_01.models.RestorePointSourceVMDataDisk] + """ super(RestorePointSourceVMStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -6194,6 +7804,8 @@ def __init__( self, **kwargs ): + """ + """ super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -6229,6 +7841,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -6238,33 +7852,33 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str + :ivar 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 + :vartype enable_cross_zone_upgrade: bool + :ivar prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before any + healthy instances. + :vartype prioritize_unhealthy_instances: bool """ _validation = { @@ -6293,6 +7907,35 @@ def __init__( prioritize_unhealthy_instances: Optional[bool] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + :keyword 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. + :paramtype enable_cross_zone_upgrade: bool + :keyword prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before + any healthy instances. + :paramtype prioritize_unhealthy_instances: bool + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -6336,6 +7979,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -6378,6 +8023,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -6398,10 +8045,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2021_04_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -6443,6 +8090,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -6455,17 +8108,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_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 + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -6494,6 +8147,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -6507,21 +8173,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_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_04_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandParameterDefinition] """ _validation = { @@ -6555,6 +8221,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2021_04_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -6565,13 +8249,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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_04_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] """ _validation = { @@ -6592,6 +8276,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -6603,10 +8296,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -6626,6 +8319,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -6636,11 +8335,11 @@ class RunCommandListResult(msrest.serialization.Model): 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_04_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -6659,6 +8358,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6669,14 +8375,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -6700,6 +8406,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -6710,8 +8426,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -6724,6 +8440,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -6731,7 +8451,7 @@ def __init__( 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. + :ivar 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 @@ -6745,7 +8465,7 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetScaleInRules] """ @@ -6759,6 +8479,24 @@ def __init__( rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetScaleInRules] + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules @@ -6766,9 +8504,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2021_04_01.models.TerminateNotificationProfile """ @@ -6782,6 +8520,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2021_04_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -6789,20 +8533,20 @@ def __init__( class SecurityProfile(msrest.serialization.Model): """Specifies the Security profile settings for the virtual machine or virtual machine scale set. - :param uefi_settings: Specifies the security settings like secure boot and vTPM used while + :ivar 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_04_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. + :vartype uefi_settings: ~azure.mgmt.compute.v2021_04_01.models.UefiSettings + :ivar 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 - :param security_type: Specifies the SecurityType of the virtual machine. It is set as + :vartype 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. Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_04_01.models.SecurityTypes + :vartype security_type: str or ~azure.mgmt.compute.v2021_04_01.models.SecurityTypes """ _attribute_map = { @@ -6819,6 +8563,22 @@ def __init__( security_type: Optional[Union[str, "SecurityTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype uefi_settings: ~azure.mgmt.compute.v2021_04_01.models.UefiSettings + :keyword 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. + :paramtype encryption_at_host: bool + :keyword 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. Possible values include: + "TrustedLaunch". + :paramtype security_type: str or ~azure.mgmt.compute.v2021_04_01.models.SecurityTypes + """ super(SecurityProfile, self).__init__(**kwargs) self.uefi_settings = uefi_settings self.encryption_at_host = encryption_at_host @@ -6846,6 +8606,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareInfoElement, self).__init__(**kwargs) self.vm_uri = None @@ -6853,14 +8615,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -6877,6 +8639,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -6896,40 +8668,40 @@ class Snapshot(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar managed_by: Unused. Always Null. :vartype managed_by: str - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku - :param extended_location: The extended location where the snapshot will be created. Extended + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku + :ivar extended_location: The extended location where the snapshot will be created. Extended location cannot be changed. - :type extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation :ivar time_created: The time when the snapshot was created. :vartype time_created: ~datetime.datetime - :param os_type: The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration - :param purchase_plan: Purchase plan information for the image from which the source disk for - the snapshot was originally created. - :type purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated - :param supported_capabilities: List of supported capabilities (like Accelerated Networking) for + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the image from which the source disk for the + snapshot was originally created. + :vartype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :ivar supported_capabilities: List of supported capabilities (like Accelerated Networking) for the image from which the source disk from the snapshot was originally created. - :type supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities - :param creation_data: Disk source information. CreationData information cannot be changed after + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :ivar creation_data: Disk source information. CreationData information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int + :vartype disk_size_gb: int :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. :vartype disk_size_bytes: long :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", @@ -6937,31 +8709,33 @@ class Snapshot(Resource): :vartype disk_state: str or ~azure.mgmt.compute.v2021_04_01.models.DiskState :ivar unique_id: Unique Guid identifying the resource. :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection :ivar provisioning_state: The disk provisioning state. :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. - :type incremental: bool - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool - :param public_network_access: Policy for controlling export on the disk. Possible values + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess - :param completion_percent: Percentage complete for the background copy when a resource is + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + :ivar completion_percent: Percentage complete for the background copy when a resource is created via the CopyStart operation. - :type completion_percent: float + :vartype completion_percent: float """ _validation = { @@ -7030,6 +8804,64 @@ def __init__( completion_percent: Optional[float] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku + :keyword extended_location: The extended location where the snapshot will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the image from which the source disk for + the snapshot was originally created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlanAutoGenerated + :keyword supported_capabilities: List of supported capabilities (like Accelerated Networking) + for the image from which the source disk from the snapshot was originally created. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_04_01.models.SupportedCapabilities + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2021_04_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :paramtype supports_hibernation: bool + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + :keyword completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :paramtype completion_percent: float + """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) self.managed_by = None self.sku = sku @@ -7060,11 +8892,11 @@ class SnapshotList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of snapshots. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.Snapshot] - :param next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -7083,6 +8915,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ super(SnapshotList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7093,9 +8932,9 @@ class SnapshotSku(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", "Standard_ZRS". - :type name: str or ~azure.mgmt.compute.v2021_04_01.models.SnapshotStorageAccountTypes + :vartype name: str or ~azure.mgmt.compute.v2021_04_01.models.SnapshotStorageAccountTypes :ivar tier: The sku tier. :vartype tier: str """ @@ -7115,6 +8954,11 @@ def __init__( name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, **kwargs ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2021_04_01.models.SnapshotStorageAccountTypes + """ super(SnapshotSku, self).__init__(**kwargs) self.name = name self.tier = None @@ -7123,36 +8967,38 @@ def __init__( class SnapshotUpdate(msrest.serialization.Model): """Snapshot update resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku - :param os_type: the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used be Azure Disk + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - :type encryption_settings_collection: + :vartype encryption_settings_collection: ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection - :param encryption: Encryption property can be used to encrypt data at rest with customer - managed keys or platform managed keys. - :type encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption - :param network_access_policy: Policy for accessing the disk via network. Possible values + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values include: "AllowAll", "AllowPrivate", "DenyAll". - :type network_access_policy: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy - :param disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. - :type disk_access_id: str - :param supports_hibernation: Indicates the OS on a snapshot supports hibernation. - :type supports_hibernation: bool - :param public_network_access: Policy for controlling export on the disk. Possible values + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess """ _attribute_map = { @@ -7183,6 +9029,41 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_04_01.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_04_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :paramtype supports_hibernation: bool + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicNetworkAccess + """ super(SnapshotUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -7199,8 +9080,8 @@ def __init__( class SourceVault(msrest.serialization.Model): """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -7213,6 +9094,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SourceVault, self).__init__(**kwargs) self.id = id @@ -7220,12 +9105,12 @@ def __init__( class SpotRestorePolicy(msrest.serialization.Model): """Specifies the Spot-Try-Restore properties for the virtual machine scale set. :code:`
    `:code:`
    ` With this property customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically based on capacity availability and pricing constraint. - :param enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be + :ivar enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based on capacity availability and pricing constraints. - :type enabled: bool - :param restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the + :vartype enabled: bool + :ivar restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances. - :type restore_timeout: str + :vartype restore_timeout: str """ _attribute_map = { @@ -7240,6 +9125,15 @@ def __init__( restore_timeout: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will + be tried to be restored opportunistically based on capacity availability and pricing + constraints. + :paramtype enabled: bool + :keyword restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the + platform will not try to restore the VMSS SPOT instances. + :paramtype restore_timeout: str + """ super(SpotRestorePolicy, self).__init__(**kwargs) self.enabled = enabled self.restore_timeout = restore_timeout @@ -7248,8 +9142,8 @@ def __init__( 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_04_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2021_04_01.models.SshPublicKey] """ _attribute_map = { @@ -7262,6 +9156,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2021_04_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -7269,15 +9167,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - :type key_data: str + :vartype key_data: str """ _attribute_map = { @@ -7292,6 +9190,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -7302,16 +9211,16 @@ class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): 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 + :ivar 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 + :vartype private_key: str + :ivar 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 + :vartype public_key: str + :ivar id: Required. The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - :type id: str + :vartype id: str """ _validation = { @@ -7334,6 +9243,18 @@ def __init__( id: str, **kwargs ): + """ + :keyword 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. + :paramtype private_key: str + :keyword 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. + :paramtype public_key: str + :keyword id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :paramtype id: str + """ super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) self.private_key = private_key self.public_key = public_key @@ -7353,15 +9274,15 @@ class SshPublicKeyResource(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _validation = { @@ -7388,6 +9309,17 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyResource, self).__init__(location=location, tags=tags, **kwargs) self.public_key = public_key @@ -7397,11 +9329,11 @@ class SshPublicKeysGroupListResult(msrest.serialization.Model): 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_04_01.models.SshPublicKeyResource] - :param next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + :ivar value: Required. The list of SSH public keys. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeyResource] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7420,6 +9352,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of SSH public keys. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeyResource] + :keyword 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. + :paramtype next_link: str + """ super(SshPublicKeysGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7428,13 +9367,13 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _attribute_map = { @@ -7449,6 +9388,15 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyUpdateResource, self).__init__(tags=tags, **kwargs) self.public_key = public_key @@ -7456,21 +9404,21 @@ def __init__( 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 + :ivar 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_04_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageReference + :ivar 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_04_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2021_04_01.models.OSDisk + :ivar 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_04_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2021_04_01.models.DataDisk] """ _attribute_map = { @@ -7487,6 +9435,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_04_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2021_04_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -7514,6 +9479,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -7521,11 +9488,11 @@ def __init__( class SubResourceWithColocationStatus(SubResource): """SubResourceWithColocationStatus. - :param id: Resource Id. - :type id: str - :param colocation_status: Describes colocation status of a resource in the Proximity Placement + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus + :vartype colocation_status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus """ _attribute_map = { @@ -7540,6 +9507,13 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword colocation_status: Describes colocation status of a resource in the Proximity + Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus + """ super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) self.colocation_status = colocation_status @@ -7547,9 +9521,9 @@ def __init__( class SupportedCapabilities(msrest.serialization.Model): """List of supported capabilities (like accelerated networking) persisted on the disk resource for VM use. - :param accelerated_network: True if the image from which the OS disk is created supports + :ivar accelerated_network: True if the image from which the OS disk is created supports accelerated networking. - :type accelerated_network: bool + :vartype accelerated_network: bool """ _attribute_map = { @@ -7562,6 +9536,11 @@ def __init__( accelerated_network: Optional[bool] = None, **kwargs ): + """ + :keyword accelerated_network: True if the image from which the OS disk is created supports + accelerated networking. + :paramtype accelerated_network: bool + """ super(SupportedCapabilities, self).__init__(**kwargs) self.accelerated_network = accelerated_network @@ -7569,13 +9548,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -7590,6 +9569,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -7600,23 +9588,23 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -7649,18 +9637,37 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ 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 + :ivar 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. + :vartype secure_boot_enabled: bool + :ivar 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 + :vartype v_tpm_enabled: bool """ _attribute_map = { @@ -7675,6 +9682,14 @@ def __init__( v_tpm_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Specifies whether vTPM should be enabled on the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype v_tpm_enabled: bool + """ super(UefiSettings, self).__init__(**kwargs) self.secure_boot_enabled = secure_boot_enabled self.v_tpm_enabled = v_tpm_enabled @@ -7710,6 +9725,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -7758,6 +9775,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -7797,6 +9816,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -7806,19 +9827,19 @@ def __init__( 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_04_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2021_04_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.AutomaticOSUpgradePolicy """ @@ -7836,6 +9857,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2021_04_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2021_04_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -7851,12 +9888,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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_04_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2021_04_01.models.UsageName """ _validation = { @@ -7883,6 +9920,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2021_04_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -7892,10 +9937,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -7910,6 +9955,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -7940,6 +9991,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -7948,7 +10001,7 @@ def __init__( 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 + :ivar 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 @@ -7959,14 +10012,14 @@ class VaultCertificate(msrest.serialization.Model): Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type certificate_url: str - :param certificate_store: For Windows VMs, specifies the certificate store on the Virtual + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -7981,6 +10034,27 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `} :code:`
    ` To install certificates on a + virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for + Linux `_ or the + `Azure Key Vault virtual machine extension for Windows + `_. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -7989,12 +10063,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2021_04_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2021_04_01.models.VaultCertificate] """ _attribute_map = { @@ -8009,6 +10083,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2021_04_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -8017,8 +10099,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -8031,6 +10113,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -8048,43 +10134,43 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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_04_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_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_04_01.models.ExtendedLocation - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :ivar 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_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -8097,46 +10183,45 @@ class VirtualMachine(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_04_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 + :vartype availability_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_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_04_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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_04_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_04_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. + :vartype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2021_04_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_04_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -8146,16 +10231,16 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -8163,15 +10248,17 @@ class VirtualMachine(Resource): 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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :ivar 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 - :param capacity_reservation: Specifies information about the capacity reservation that is used + :vartype user_data: str + :ivar capacity_reservation: Specifies information about the capacity reservation that is used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile + :vartype capacity_reservation: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile """ _validation = { @@ -8254,6 +10341,126 @@ def __init__( capacity_reservation: Optional["CapacityReservationProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + :keyword capacity_reservation: Specifies information about the capacity reservation that is + used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. + :paramtype capacity_reservation: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -8289,13 +10496,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -8312,6 +10519,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -8377,6 +10593,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -8393,13 +10611,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -8422,6 +10640,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -8433,8 +10660,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -8466,6 +10693,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -8486,36 +10717,37 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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_04_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -8560,6 +10792,37 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -8576,12 +10839,12 @@ def __init__( 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_04_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus """ _attribute_map = { @@ -8598,6 +10861,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -8617,23 +10888,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -8668,6 +10939,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -8679,16 +10969,16 @@ def __init__( 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_04_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -8709,6 +10999,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -8720,8 +11022,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -8734,6 +11036,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -8741,29 +11047,29 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _attribute_map = { @@ -8792,6 +11098,31 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -8824,6 +11155,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -8839,15 +11172,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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_04_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2021_04_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_04_01.models.UserAssignedIdentitiesValue] """ @@ -8870,6 +11203,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2021_04_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_04_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -8882,18 +11227,18 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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_04_01.models.ExtendedLocation + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation """ _validation = { @@ -8919,6 +11264,20 @@ def __init__( extended_location: Optional["ExtendedLocation"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -8931,36 +11290,37 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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_04_01.models.ExtendedLocation - :param plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2021_04_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2021_04_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2021_04_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2021_04_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2021_04_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationTypes + :ivar disallowed: Specifies disallowed configuration for the VirtualMachine created from the image. - :type disallowed: ~azure.mgmt.compute.v2021_04_01.models.DisallowedConfiguration - :param features: - :type features: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineImageFeature] + :vartype disallowed: ~azure.mgmt.compute.v2021_04_01.models.DisallowedConfiguration + :ivar features: + :vartype features: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineImageFeature] """ _validation = { @@ -9000,6 +11360,40 @@ def __init__( features: Optional[List["VirtualMachineImageFeature"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2021_04_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2021_04_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2021_04_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2021_04_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationTypes + :keyword disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :paramtype disallowed: ~azure.mgmt.compute.v2021_04_01.models.DisallowedConfiguration + :keyword features: + :paramtype features: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineImageFeature] + """ 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 @@ -9013,10 +11407,10 @@ def __init__( 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 + :ivar name: The name of the feature. + :vartype name: str + :ivar value: The corresponding value for the feature. + :vartype value: str """ _attribute_map = { @@ -9031,6 +11425,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the feature. + :paramtype name: str + :keyword value: The corresponding value for the feature. + :paramtype value: str + """ super(VirtualMachineImageFeature, self).__init__(**kwargs) self.name = name self.value = value @@ -9041,18 +11441,19 @@ class VirtualMachineInstallPatchesParameters(msrest.serialization.Model): 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 + :ivar 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 + :vartype maximum_duration: str + :ivar 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_04_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_04_01.models.WindowsParameters - :param linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + :vartype reboot_setting: str or + ~azure.mgmt.compute.v2021_04_01.models.VMGuestPatchRebootSetting + :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the + API. + :vartype windows_parameters: ~azure.mgmt.compute.v2021_04_01.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the API. - :type linux_parameters: ~azure.mgmt.compute.v2021_04_01.models.LinuxParameters + :vartype linux_parameters: ~azure.mgmt.compute.v2021_04_01.models.LinuxParameters """ _validation = { @@ -9076,6 +11477,21 @@ def __init__( linux_parameters: Optional["LinuxParameters"] = None, **kwargs ): + """ + :keyword 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). + :paramtype maximum_duration: str + :keyword reboot_setting: Required. Defines when it is acceptable to reboot a VM during a + software update operation. Possible values include: "IfRequired", "Never", "Always". + :paramtype reboot_setting: str or + ~azure.mgmt.compute.v2021_04_01.models.VMGuestPatchRebootSetting + :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :paramtype windows_parameters: ~azure.mgmt.compute.v2021_04_01.models.WindowsParameters + :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :paramtype linux_parameters: ~azure.mgmt.compute.v2021_04_01.models.LinuxParameters + """ super(VirtualMachineInstallPatchesParameters, self).__init__(**kwargs) self.maximum_duration = maximum_duration self.reboot_setting = reboot_setting @@ -9160,6 +11576,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineInstallPatchesResult, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -9180,47 +11598,47 @@ class VirtualMachineInstanceView(msrest.serialization.Model): 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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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_04_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_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2021_04_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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_04_01.models.BootDiagnosticsInstanceView + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_04_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_04_01.models.InstanceViewStatus] - :param patch_status: [Preview Feature] The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePatchStatus + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar patch_status: [Preview Feature] The status of virtual machine patch operations. + :vartype patch_status: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePatchStatus """ _validation = { @@ -9266,6 +11684,43 @@ def __init__( patch_status: Optional["VirtualMachinePatchStatus"] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_04_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_04_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_04_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :keyword patch_status: [Preview Feature] The status of virtual machine patch operations. + :paramtype patch_status: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePatchStatus + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -9288,10 +11743,10 @@ def __init__( class VirtualMachineIpTag(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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -9306,6 +11761,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -9316,11 +11777,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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_04_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -9339,6 +11800,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9349,31 +11817,31 @@ class VirtualMachineNetworkInterfaceConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The network interface configuration name. - :type name: str - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar name: Required. The network interface configuration name. + :vartype name: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - :param enable_accelerated_networking: Specifies whether the network interface is accelerated + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :ivar 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 enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceIPConfiguration] - :param dscp_configuration: - :type dscp_configuration: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar dscp_configuration: + :vartype dscp_configuration: ~azure.mgmt.compute.v2021_04_01.models.SubResource """ _validation = { @@ -9408,6 +11876,33 @@ def __init__( dscp_configuration: Optional["SubResource"] = None, **kwargs ): + """ + :keyword name: Required. The network interface configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineNetworkInterfaceIPConfiguration] + :keyword dscp_configuration: + :paramtype dscp_configuration: ~azure.mgmt.compute.v2021_04_01.models.SubResource + """ super(VirtualMachineNetworkInterfaceConfiguration, self).__init__(**kwargs) self.name = name self.primary = primary @@ -9424,8 +11919,8 @@ def __init__( class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(msrest.serialization.Model): """Describes a virtual machines network configuration's DNS settings. - :param dns_servers: List of DNS servers IP addresses. - :type dns_servers: list[str] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -9438,6 +11933,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineNetworkInterfaceDnsSettingsConfiguration, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -9447,34 +11946,34 @@ class VirtualMachineNetworkInterfaceIPConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The IP configuration name. - :type name: str - :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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_04_01.models.IPVersions - :param application_security_groups: Specifies an array of references to application security + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersions + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :ivar application_gateway_backend_address_pools: Specifies an array of references to backend address pools of application gateways. A virtual machine can reference backend address pools of multiple application gateways. Multiple virtual machines cannot use the same application gateway. - :type application_gateway_backend_address_pools: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :ivar load_balancer_backend_address_pools: Specifies an array of references to backend address pools of load balancers. A virtual machine can reference backend address pools of one public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] """ @@ -9506,6 +12005,38 @@ def __init__( load_balancer_backend_address_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersions + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A virtual machine can reference backend address pools of + multiple application gateways. Multiple virtual machines cannot use the same application + gateway. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword load_balancer_backend_address_pools: Specifies an array of references to backend + address pools of load balancers. A virtual machine can reference backend address pools of one + public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku + load balancer]. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + """ super(VirtualMachineNetworkInterfaceIPConfiguration, self).__init__(**kwargs) self.name = name self.subnet = subnet @@ -9522,12 +12053,12 @@ class VirtualMachinePatchStatus(msrest.serialization.Model): 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 + :ivar available_patch_summary: The available patch summary of the latest assessment operation for the virtual machine. - :type available_patch_summary: ~azure.mgmt.compute.v2021_04_01.models.AvailablePatchSummary - :param last_patch_installation_summary: The installation summary of the latest installation + :vartype available_patch_summary: ~azure.mgmt.compute.v2021_04_01.models.AvailablePatchSummary + :ivar last_patch_installation_summary: The installation summary of the latest installation operation for the virtual machine. - :type last_patch_installation_summary: + :vartype last_patch_installation_summary: ~azure.mgmt.compute.v2021_04_01.models.LastPatchInstallationSummary :ivar configuration_statuses: The enablement status of the specified patchMode. :vartype configuration_statuses: @@ -9551,6 +12082,16 @@ def __init__( last_patch_installation_summary: Optional["LastPatchInstallationSummary"] = None, **kwargs ): + """ + :keyword available_patch_summary: The available patch summary of the latest assessment + operation for the virtual machine. + :paramtype available_patch_summary: + ~azure.mgmt.compute.v2021_04_01.models.AvailablePatchSummary + :keyword last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :paramtype last_patch_installation_summary: + ~azure.mgmt.compute.v2021_04_01.models.LastPatchInstallationSummary + """ super(VirtualMachinePatchStatus, self).__init__(**kwargs) self.available_patch_summary = available_patch_summary self.last_patch_installation_summary = last_patch_installation_summary @@ -9562,29 +12103,29 @@ class VirtualMachinePublicIPAddressConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The publicIP address configuration name. - :type name: str - :param sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku - :param idle_timeout_in_minutes: The idle timeout of the public IP address. - :type idle_timeout_in_minutes: int - :param delete_option: Specify what happens to the public IP address when the VM is deleted. + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar delete_option: Specify what happens to the public IP address when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions - :param dns_settings: The dns settings to be applied on the publicIP addresses . - :type dns_settings: + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_01.models.IPVersions - :param public_ip_allocation_method: Specify the public IP allocation type. Possible values + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersions + :ivar public_ip_allocation_method: Specify the public IP allocation type. Possible values include: "Dynamic", "Static". - :type public_ip_allocation_method: str or + :vartype public_ip_allocation_method: str or ~azure.mgmt.compute.v2021_04_01.models.PublicIPAllocationMethod """ @@ -9618,6 +12159,32 @@ def __init__( public_ip_allocation_method: Optional[Union[str, "PublicIPAllocationMethod"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword sku: Describes the public IP Sku. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword delete_option: Specify what happens to the public IP address when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersions + :keyword public_ip_allocation_method: Specify the public IP allocation type. Possible values + include: "Dynamic", "Static". + :paramtype public_ip_allocation_method: str or + ~azure.mgmt.compute.v2021_04_01.models.PublicIPAllocationMethod + """ super(VirtualMachinePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.sku = sku @@ -9635,10 +12202,10 @@ class VirtualMachinePublicIPAddressDnsSettingsConfiguration(msrest.serialization All required parameters must be populated in order to send to Azure. - :param domain_name_label: Required. The Domain name label prefix of the PublicIPAddress + :ivar domain_name_label: Required. The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. - :type domain_name_label: str + :vartype domain_name_label: str """ _validation = { @@ -9655,6 +12222,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword domain_name_label: Required. The Domain name label prefix of the PublicIPAddress + resources that will be created. The generated name label is the concatenation of the domain + name label and vm network profile unique ID. + :paramtype domain_name_label: str + """ super(VirtualMachinePublicIPAddressDnsSettingsConfiguration, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -9662,9 +12235,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -9677,6 +12250,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -9694,33 +12272,33 @@ class VirtualMachineRunCommand(Resource): :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_04_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -9772,6 +12350,35 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -9789,23 +12396,23 @@ def __init__( 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", + :ivar execution_state: Script execution status. Possible values include: "Unknown", "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". - :type execution_state: str or ~azure.mgmt.compute.v2021_04_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_04_01.models.InstanceViewStatus] + :vartype execution_state: str or ~azure.mgmt.compute.v2021_04_01.models.ExecutionState + :ivar execution_message: Communicate script configuration errors or execution messages. + :vartype execution_message: str + :ivar exit_code: Exit code returned from script execution. + :vartype exit_code: int + :ivar output: Script output stream. + :vartype output: str + :ivar error: Script error stream. + :vartype error: str + :ivar start_time: Script start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Script end time. + :vartype end_time: ~datetime.datetime + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] """ _attribute_map = { @@ -9832,6 +12439,25 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword execution_state: Script execution status. Possible values include: "Unknown", + "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :paramtype execution_state: str or ~azure.mgmt.compute.v2021_04_01.models.ExecutionState + :keyword execution_message: Communicate script configuration errors or execution messages. + :paramtype execution_message: str + :keyword exit_code: Exit code returned from script execution. + :paramtype exit_code: int + :keyword output: Script output stream. + :paramtype output: str + :keyword error: Script error stream. + :paramtype error: str + :keyword start_time: Script start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Script end time. + :paramtype end_time: ~datetime.datetime + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) self.execution_state = execution_state self.execution_message = execution_message @@ -9846,12 +12472,12 @@ def __init__( 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 + :ivar script: Specifies the script content to be executed on the VM. + :vartype script: str + :ivar script_uri: Specifies the script download location. + :vartype script_uri: str + :ivar command_id: Specifies a commandId of predefined built-in script. + :vartype command_id: str """ _attribute_map = { @@ -9868,6 +12494,14 @@ def __init__( command_id: Optional[str] = None, **kwargs ): + """ + :keyword script: Specifies the script content to be executed on the VM. + :paramtype script: str + :keyword script_uri: Specifies the script download location. + :paramtype script_uri: str + :keyword command_id: Specifies a commandId of predefined built-in script. + :paramtype command_id: str + """ super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) self.script = script self.script_uri = script_uri @@ -9879,10 +12513,10 @@ class VirtualMachineRunCommandsListResult(msrest.serialization.Model): 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_04_01.models.VirtualMachineRunCommand] - :param next_link: The uri to fetch the next page of run commands. - :type next_link: str + :ivar value: Required. The list of run commands. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] + :ivar next_link: The uri to fetch the next page of run commands. + :vartype next_link: str """ _validation = { @@ -9901,6 +12535,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of run commands. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] + :keyword next_link: The uri to fetch the next page of run commands. + :paramtype next_link: str + """ super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9911,31 +12551,31 @@ class VirtualMachineRunCommandUpdate(UpdateResource): 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_04_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -9978,6 +12618,33 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2021_04_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -10005,75 +12672,75 @@ class VirtualMachineScaleSet(Resource): :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_04_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :ivar 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_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_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_04_01.models.ExtendedLocation - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine Scale Set. + :vartype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2021_04_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar 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 + :vartype single_placement_group: bool + :ivar zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. - :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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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_04_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_04_01.models.SubResource - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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. + :vartype host_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :ivar 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_04_01.models.ScaleInPolicy - :param orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. + :vartype scale_in_policy: ~azure.mgmt.compute.v2021_04_01.models.ScaleInPolicy + :ivar 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_04_01.models.OrchestrationMode - :param spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale + :vartype orchestration_mode: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationMode + :ivar spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale set. - :type spot_restore_policy: ~azure.mgmt.compute.v2021_04_01.models.SpotRestorePolicy + :vartype spot_restore_policy: ~azure.mgmt.compute.v2021_04_01.models.SpotRestorePolicy """ _validation = { @@ -10140,6 +12807,75 @@ def __init__( spot_restore_policy: Optional["SpotRestorePolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine Scale Set. + :paramtype extended_location: ~azure.mgmt.compute.v2021_04_01.models.ExtendedLocation + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. zoneBalance property can only be set if the zones + property of the scale set contains more than one zone. If there are no zones or only one zone + specified, then zoneBalance property should not be set. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2021_04_01.models.ScaleInPolicy + :keyword orchestration_mode: Specifies the orchestration mode for the virtual machine scale + set. Possible values include: "Uniform", "Flexible". + :paramtype orchestration_mode: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationMode + :keyword spot_restore_policy: Specifies the Spot Restore properties for the virtual machine + scale set. + :paramtype spot_restore_policy: ~azure.mgmt.compute.v2021_04_01.models.SpotRestorePolicy + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -10169,39 +12905,39 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetManagedDiskParameters - :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + :ivar 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. + :vartype disk_iops_read_write: long + :ivar 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 + :vartype disk_m_bps_read_write: long """ _validation = { @@ -10235,6 +12971,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword 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. + :paramtype disk_iops_read_write: long + :keyword 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. + :paramtype disk_m_bps_read_write: long + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -10254,37 +13025,37 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -10324,6 +13095,35 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.type = None @@ -10344,11 +13144,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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_04_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -10367,6 +13167,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10375,13 +13182,14 @@ def __init__( 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_04_01.models.VirtualMachineScaleSetExtension] - :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype extensions_time_budget: str """ _attribute_map = { @@ -10396,6 +13204,16 @@ def __init__( extensions_time_budget: Optional[str] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype extensions_time_budget: str + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions self.extensions_time_budget = extensions_time_budget @@ -10412,33 +13230,33 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -10478,6 +13296,33 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -10504,17 +13349,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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_04_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: + :vartype type: str or ~azure.mgmt.compute.v2021_04_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -10537,6 +13381,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2021_04_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -10569,6 +13427,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -10585,8 +13445,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] :ivar orchestration_services: The orchestration services information. :vartype orchestration_services: list[~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceSummary] @@ -10611,6 +13471,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -10640,6 +13504,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -10649,39 +13515,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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_04_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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_04_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :ivar 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: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :ivar 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. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_04_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_04_01.models.SubResource] """ _validation = { @@ -10716,6 +13583,44 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -10731,10 +13636,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -10749,6 +13654,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -10759,11 +13670,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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_04_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2021_04_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -10782,6 +13694,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2021_04_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10792,11 +13712,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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_04_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -10815,6 +13735,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10825,11 +13752,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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_04_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -10848,6 +13775,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10858,11 +13792,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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_04_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -10881,6 +13815,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10889,14 +13830,16 @@ def __init__( 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: + :ivar 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_04_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -10911,6 +13854,18 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_04_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetParameters + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -10921,31 +13876,31 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar 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_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions """ _validation = { @@ -10980,6 +13935,33 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -10995,8 +13977,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -11009,6 +13991,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -11016,17 +14002,17 @@ def __init__( 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 + :ivar 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_04_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion """ _attribute_map = { @@ -11043,6 +14029,19 @@ def __init__( network_api_version: Optional[Union[str, "NetworkApiVersion"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -11054,43 +14053,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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_04_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :ivar 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_04_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2021_04_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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_04_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -11126,6 +14125,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_04_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2021_04_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_04_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -11142,20 +14181,19 @@ def __init__( 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 + :ivar 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. - :type admin_username: str - :param admin_password: Specifies the password of the administrator account. + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -11169,28 +14207,28 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration + :ivar 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 `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machines in the scale set. To install certificates on a virtual machine it is recommended to - use the `Azure Key Vault virtual machine extension for Linux + :vartype linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. To install certificates on a virtual machine it is recommended to use the + `Azure Key Vault virtual machine extension for Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] + :vartype secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] """ _attribute_map = { @@ -11215,6 +14253,57 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. To install certificates on a virtual machine it is recommended to + use the `Azure Key Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -11230,26 +14319,26 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo All required parameters must be populated in order to send to Azure. - :param name: Required. The publicIP address configuration name. - :type name: str - :param sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku - :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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_04_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_04_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_04_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_01.models.IPVersion - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersion + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions """ _validation = { @@ -11280,6 +14369,28 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword sku: Describes the public IP Sku. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersion + :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.sku = sku @@ -11296,10 +14407,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -11316,6 +14427,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -11323,9 +14440,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -11338,19 +14455,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -11365,6 +14487,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -11398,6 +14529,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -11439,6 +14572,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -11449,21 +14584,22 @@ def __init__( 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 + :ivar 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_04_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageReference + :ivar 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_04_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetOSDisk + :ivar 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_04_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -11480,6 +14616,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -11489,45 +14643,45 @@ def __init__( 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_04_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2021_04_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2021_04_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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_04_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :ivar 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_04_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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2021_04_01.models.ScaleInPolicy + :ivar 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_04_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource """ _attribute_map = { @@ -11564,6 +14718,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2021_04_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2021_04_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_04_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :keyword 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. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2021_04_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -11582,34 +14779,34 @@ def __init__( 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_04_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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_04_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_04_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_04_01.models.SubResource] """ _attribute_map = { @@ -11640,6 +14837,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_04_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2021_04_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -11655,30 +14884,30 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar 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_04_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions """ _attribute_map = { @@ -11709,6 +14938,32 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -11724,17 +14979,17 @@ def __init__( 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 + :ivar 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_04_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion """ _attribute_map = { @@ -11751,6 +15006,19 @@ def __init__( network_api_version: Optional[Union[str, "NetworkApiVersion"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2021_04_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_04_01.models.NetworkApiVersion + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -11760,23 +15028,23 @@ def __init__( 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_04_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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_04_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: + :vartype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -11800,6 +15068,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_04_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_04_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -11812,14 +15100,14 @@ def __init__( 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_04_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] """ _attribute_map = { @@ -11838,6 +15126,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_04_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_04_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2021_04_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -11848,16 +15146,16 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions """ _attribute_map = { @@ -11876,6 +15174,18 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_04_01.models.DeleteOptions + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -11886,12 +15196,13 @@ def __init__( 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_04_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -11908,6 +15219,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2021_04_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -11917,31 +15237,33 @@ def __init__( 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_04_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar security_profile: The virtual machine scale set Security profile. + :vartype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2021_04_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. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar 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_04_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :vartype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :ivar 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 + :vartype user_data: str """ _attribute_map = { @@ -11972,6 +15294,35 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword security_profile: The virtual machine scale set Security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -11998,20 +15349,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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_04_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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_04_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -12024,29 +15375,29 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile + :ivar 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_04_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: + :vartype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -12056,10 +15407,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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_04_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2021_04_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 + :ivar 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: @@ -12069,16 +15420,16 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMProtectionPolicy - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :ivar 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 + :vartype user_data: str """ _validation = { @@ -12147,6 +15498,69 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMProtectionPolicy + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -12183,32 +15597,33 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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_04_01.models.VirtualMachineExtensionInstanceView + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView """ _validation = { @@ -12248,6 +15663,33 @@ def __init__( instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView + """ super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) self.name = None self.type = None @@ -12266,8 +15708,8 @@ def __init__( 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_04_01.models.VirtualMachineScaleSetVMExtension] + :ivar value: The list of VMSS VM extensions. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] """ _attribute_map = { @@ -12280,6 +15722,11 @@ def __init__( value: Optional[List["VirtualMachineScaleSetVMExtension"]] = None, **kwargs ): + """ + :keyword value: The list of VMSS VM extensions. + :paramtype value: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] + """ super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -12310,6 +15757,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -12326,28 +15775,28 @@ class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any """ _validation = { @@ -12383,6 +15832,30 @@ def __init__( protected_settings: Optional[Any] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + """ super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -12399,10 +15872,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -12415,6 +15888,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -12424,8 +15903,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -12442,6 +15921,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -12451,39 +15934,39 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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_04_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2021_04_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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_04_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_04_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_04_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 + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -12521,6 +16004,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_04_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2021_04_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_04_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_04_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -12541,11 +16052,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -12564,6 +16075,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -12572,8 +16090,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -12587,6 +16105,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -12594,27 +16117,27 @@ def __init__( 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_04_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :ivar security_profile: Specifies the Security related profile settings for the virtual machines in the scale set. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -12624,31 +16147,33 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :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. + :vartype license_type: str + :ivar 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_04_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype priority: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :ivar 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_04_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile - :param user_data: UserData for the virtual machines in the scale set, which must be base-64 + :vartype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :ivar user_data: UserData for the virtual machines in the scale set, 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 - :param capacity_reservation: Specifies the capacity reservation related details of a scale set. + :vartype user_data: str + :ivar capacity_reservation: Specifies the capacity reservation related details of a scale set. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile + :vartype capacity_reservation: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile """ _attribute_map = { @@ -12685,6 +16210,65 @@ def __init__( capacity_reservation: Optional["CapacityReservationProfile"] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetNetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :paramtype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtensionProfile + :keyword 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. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :keyword user_data: UserData for the virtual machines in the scale set, which must be base-64 + encoded. Customer should not pass any secrets in here. :code:`
    `:code:`
    `Minimum + api-version: 2021-03-01. + :paramtype user_data: str + :keyword capacity_reservation: Specifies the capacity reservation related details of a scale + set. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. + :paramtype capacity_reservation: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -12704,13 +16288,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -12725,6 +16309,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -12733,24 +16326,24 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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. For + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. For Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or https://docs.microsoft.com/rest/api/compute/resourceskus/list. - :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 + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -12773,6 +16366,26 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. For + Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM + uses. For accurate vCPU count, please refer to + https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or + https://docs.microsoft.com/rest/api/compute/resourceskus/list. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -12785,8 +16398,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSize] """ _attribute_map = { @@ -12799,6 +16412,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -12864,6 +16481,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -12902,6 +16521,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -12912,37 +16533,37 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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_04_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_04_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_04_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :ivar 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_04_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -12955,46 +16576,45 @@ class VirtualMachineUpdate(UpdateResource): 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_04_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 + :vartype availability_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_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_04_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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_04_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_04_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. + :vartype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :ivar 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_04_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2021_04_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_04_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -13004,16 +16624,16 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -13021,15 +16641,17 @@ class VirtualMachineUpdate(UpdateResource): 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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :ivar 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 - :param capacity_reservation: Specifies information about the capacity reservation that is used + :vartype user_data: str + :ivar capacity_reservation: Specifies information about the capacity reservation that is used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile + :vartype capacity_reservation: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile """ _validation = { @@ -13099,6 +16721,122 @@ def __init__( capacity_reservation: Optional["CapacityReservationProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_04_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_04_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_04_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_04_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2021_04_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_04_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_04_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_04_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2021_04_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_04_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_04_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_04_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + :keyword capacity_reservation: Specifies information about the capacity reservation that is + used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. + :paramtype capacity_reservation: + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationProfile + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -13132,11 +16870,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -13149,6 +16887,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -13156,31 +16901,31 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". + :vartype enable_automatic_updates: bool + :ivar 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 + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2021_04_01.models.AdditionalUnattendContent] - :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on Windows. - :type patch_settings: ~azure.mgmt.compute.v2021_04_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :vartype patch_settings: ~azure.mgmt.compute.v2021_04_01.models.PatchSettings + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2021_04_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2021_04_01.models.WinRMConfiguration """ _attribute_map = { @@ -13203,6 +16948,33 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword 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 + `_. + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2021_04_01.models.AdditionalUnattendContent] + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :paramtype patch_settings: ~azure.mgmt.compute.v2021_04_01.models.PatchSettings + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2021_04_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -13215,20 +16987,20 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Windows. - :type classifications_to_include: list[str or + :vartype classifications_to_include: list[str or ~azure.mgmt.compute.v2021_04_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 + :ivar kb_numbers_to_include: Kbs to include in the patch operation. + :vartype kb_numbers_to_include: list[str] + :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :vartype kb_numbers_to_exclude: list[str] + :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :type exclude_kbs_requiring_reboot: bool - :param max_patch_publish_date: This is used to install patches that were published on or before + :vartype exclude_kbs_requiring_reboot: bool + :ivar max_patch_publish_date: This is used to install patches that were published on or before this given max published date. - :type max_patch_publish_date: ~datetime.datetime + :vartype max_patch_publish_date: ~datetime.datetime """ _attribute_map = { @@ -13249,6 +17021,22 @@ def __init__( max_patch_publish_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Windows. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_04_01.models.VMGuestPatchClassificationWindows] + :keyword kb_numbers_to_include: Kbs to include in the patch operation. + :paramtype kb_numbers_to_include: list[str] + :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :paramtype kb_numbers_to_exclude: list[str] + :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :paramtype exclude_kbs_requiring_reboot: bool + :keyword max_patch_publish_date: This is used to install patches that were published on or + before this given max published date. + :paramtype max_patch_publish_date: ~datetime.datetime + """ super(WindowsParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.kb_numbers_to_include = kb_numbers_to_include @@ -13260,8 +17048,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2021_04_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2021_04_01.models.WinRMListener] """ _attribute_map = { @@ -13274,6 +17062,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2021_04_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -13281,11 +17073,11 @@ def __init__( 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 + :ivar 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_04_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2021_04_01.models.ProtocolTypes + :ivar 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 @@ -13296,7 +17088,7 @@ class WinRMListener(msrest.serialization.Model): Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type certificate_url: str + :vartype certificate_url: str """ _attribute_map = { @@ -13311,6 +17103,24 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2021_04_01.models.ProtocolTypes + :keyword 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:`
    `} :code:`
    ` To install certificates on a + virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for + Linux `_ or the + `Azure Key Vault virtual machine extension for Windows + `_. + :paramtype certificate_url: str + """ 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_04_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_availability_sets_operations.py index 06aa855f7d1c..b8d8bd5221e9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_04_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py index fcf37323aec6..459178c69f39 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py @@ -5,23 +5,260 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CapacityReservationGroupsOperations(object): """CapacityReservationGroupsOperations operations. @@ -45,14 +282,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - parameters, # type: "_models.CapacityReservationGroup" - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservationGroup" + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: "_models.CapacityReservationGroup", + **kwargs: Any + ) -> "_models.CapacityReservationGroup": """The operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. @@ -73,32 +310,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CapacityReservationGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroup') - 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 @@ -116,16 +343,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - parameters, # type: "_models.CapacityReservationGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservationGroup" + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: "_models.CapacityReservationGroupUpdate", + **kwargs: Any + ) -> "_models.CapacityReservationGroup": """The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. @@ -145,32 +374,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') - 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 @@ -184,15 +403,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + capacity_reservation_group_name: str, + **kwargs: Any + ) -> None: """The operation to delete a capacity reservation group. This operation is allowed only if all the associated resources are disassociated from the reservation group and all capacity reservations under the reservation group have also been deleted. Please refer to @@ -212,27 +433,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,14 +456,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - expand=None, # type: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservationGroup" + resource_group_name: str, + capacity_reservation_group_name: str, + expand: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.CapacityReservationGroup": """The operation that retrieves information about a capacity reservation group. :param resource_group_name: The name of the resource group. @@ -263,7 +475,8 @@ def get( the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservationGroup, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroup @@ -274,29 +487,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,15 +512,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapacityReservationGroupListResult"] + resource_group_name: str, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any + ) -> Iterable["_models.CapacityReservationGroupListResult"]: """Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the response to get the next page of capacity reservation groups. @@ -327,10 +531,13 @@ def list_by_resource_group( :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -338,37 +545,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -386,27 +589,31 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups'} # type: ignore + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapacityReservationGroupListResult"] + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any + ) -> Iterable["_models.CapacityReservationGroupListResult"]: """Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity reservation groups. :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -414,36 +621,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -461,6 +663,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py index 9e1d3eefb78b..27873d7ad5a1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py @@ -5,25 +5,233 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_capacity_reservation_group_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CapacityReservationsOperations(object): """CapacityReservationsOperations operations. @@ -49,45 +257,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservation" - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservation" + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservation", + **kwargs: Any + ) -> "_models.CapacityReservation": cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservation') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservation') - 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 @@ -105,17 +302,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservation" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CapacityReservation"] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservation", + **kwargs: Any + ) -> LROPoller["_models.CapacityReservation"]: """The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. @@ -130,15 +329,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservation :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +355,21 @@ def begin_create_or_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +381,39 @@ def get_long_running_output(pipeline_response): ) 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservationUpdate" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CapacityReservation"] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservationUpdate", + **kwargs: Any + ) -> Optional["_models.CapacityReservation"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CapacityReservation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationUpdate') - 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 @@ -242,17 +429,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservationUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CapacityReservation"] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservationUpdate", + **kwargs: Any + ) -> LROPoller["_models.CapacityReservation"]: """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. @@ -265,15 +454,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -286,28 +480,21 @@ def begin_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -319,43 +506,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> 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-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,14 +545,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more details. @@ -388,15 +566,17 @@ def begin_delete( :type capacity_reservation_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -411,22 +591,14 @@ def begin_delete( 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -438,17 +610,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - expand=None, # type: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservation" + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + expand: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.CapacityReservation": """The operation that retrieves information about the capacity reservation. :param resource_group_name: The name of the resource group. @@ -460,7 +633,8 @@ def get( :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservation, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_04_01.models.CapacityReservation @@ -471,30 +645,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -508,15 +671,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def list_by_capacity_reservation_group( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapacityReservationListResult"] + resource_group_name: str, + capacity_reservation_group_name: str, + **kwargs: Any + ) -> Iterable["_models.CapacityReservationListResult"]: """Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in the response to get the next page of capacity reservations. @@ -525,8 +690,10 @@ def list_by_capacity_reservation_group( :param capacity_reservation_group_name: The name of the capacity reservation group. :type capacity_reservation_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 CapacityReservationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationListResult] + :return: An iterator like instance of either CapacityReservationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] @@ -534,36 +701,33 @@ def list_by_capacity_reservation_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_capacity_reservation_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_capacity_reservation_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -581,6 +745,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py index 1a5641b94a9f..793310a1184e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +296,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +359,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +388,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +415,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,14 +438,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -267,29 +467,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,22 +492,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_04_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -326,35 +519,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -372,22 +561,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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_04_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -395,34 +587,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -440,6 +627,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py index 51626784a636..e1fa37b4bf41 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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_04_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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_04_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -463,30 +630,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,15 +656,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -517,8 +675,10 @@ def list_by_host_group( :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_04_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -526,36 +686,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -573,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py index 793b5bdce791..e79d3a57ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py @@ -5,25 +5,440 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_a_private_endpoint_connection_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_endpoint_connections_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskAccessesOperations(object): """DiskAccessesOperations operations. @@ -49,43 +464,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccess') - 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 @@ -103,16 +507,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccess" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Creates or updates a disk access resource. :param resource_group_name: The name of the resource group. @@ -125,15 +531,18 @@ def begin_create_or_update( :type disk_access: ~azure.mgmt.compute.v2021_04_01.models.DiskAccess :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +554,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +580,37 @@ def get_long_running_output(pipeline_response): ) 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/diskAccesses/{diskAccessName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> "_models.DiskAccess": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_access, 'DiskAccessUpdate') - 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 @@ -235,16 +628,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_access_name, # type: str - disk_access, # type: "_models.DiskAccessUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskAccess"] + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: """Updates (patches) a disk access resource. :param resource_group_name: The name of the resource group. @@ -257,15 +652,18 @@ def begin_update( :type disk_access: ~azure.mgmt.compute.v2021_04_01.models.DiskAccessUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 DiskAccess or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +675,21 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskAccess', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +701,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskAccess" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.DiskAccess": """Gets information about a disk access resource. :param resource_group_name: The name of the resource group. @@ -336,27 +729,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +753,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> 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-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,13 +791,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk access resource. :param resource_group_name: The name of the resource group. @@ -434,15 +809,17 @@ def begin_delete( :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -456,21 +833,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -482,14 +852,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a resource group. :param resource_group_name: The name of the resource group. @@ -504,35 +875,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -550,16 +917,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskAccessList"] + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: """Lists all the disk access resources under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -572,34 +940,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskAccessList', pipeline_response) + deserialized = self._deserialize("DiskAccessList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -617,18 +980,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + @distributed_trace def get_private_link_resources( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources possible under disk access resource. :param resource_group_name: The name of the resource group. @@ -647,27 +1011,17 @@ def get_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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 = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -681,49 +1035,40 @@ def get_private_link_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + def _update_a_private_endpoint_connection_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - 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 @@ -741,17 +1086,19 @@ def _update_a_private_endpoint_connection_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_update_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. @@ -765,18 +1112,24 @@ def begin_update_a_private_endpoint_connection( :type private_endpoint_connection_name: str :param private_endpoint_connection: private endpoint connection object supplied in the body of the Put private endpoint connection operation. - :type private_endpoint_connection: ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -789,28 +1142,21 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -822,16 +1168,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def get_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets information about a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. @@ -852,28 +1199,18 @@ def get_a_private_endpoint_connection( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_a_private_endpoint_connection.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -887,43 +1224,34 @@ def get_a_private_endpoint_connection( return cls(pipeline_response, deserialized, {}) return deserialized + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_a_private_endpoint_connection_initial( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> 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-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_a_private_endpoint_connection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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 = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -936,14 +1264,15 @@ def _delete_a_private_endpoint_connection_initial( _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete_a_private_endpoint_connection( self, - resource_group_name, # type: str - disk_access_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a private endpoint connection under a disk access resource. :param resource_group_name: The name of the resource group. @@ -956,15 +1285,17 @@ def begin_delete_a_private_endpoint_connection( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -979,22 +1310,14 @@ def begin_delete_a_private_endpoint_connection( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1006,15 +1329,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_private_endpoint_connections( self, - resource_group_name, # type: str - disk_access_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List information about private endpoint connections under a disk access resource. :param resource_group_name: The name of the resource group. @@ -1024,8 +1348,10 @@ def list_private_endpoint_connections( are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. :type disk_access_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -1033,36 +1359,33 @@ def list_private_endpoint_connections( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_private_endpoint_connections.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskAccessName': self._serialize.url("disk_access_name", disk_access_name, '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) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1080,6 +1403,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py index 6e79325cfacf..6faf65807c01 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py @@ -5,25 +5,285 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_associated_resources_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskEncryptionSetsOperations(object): """DiskEncryptionSetsOperations operations. @@ -49,43 +309,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') - 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 @@ -103,16 +352,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Creates or updates a disk encryption set. :param resource_group_name: The name of the resource group. @@ -126,15 +377,19 @@ def begin_create_or_update( :type disk_encryption_set: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,27 +401,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,47 +427,37 @@ def get_long_running_output(pipeline_response): ) 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') - 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 @@ -236,16 +475,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - disk_encryption_set, # type: "_models.DiskEncryptionSetUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiskEncryptionSet"] + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: """Updates (patches) a disk encryption set. :param resource_group_name: The name of the resource group. @@ -259,15 +500,19 @@ def begin_update( :type disk_encryption_set: ~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of cls(response) + :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 DiskEncryptionSet or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +524,21 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,15 +550,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskEncryptionSet" + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": """Gets information about a disk encryption set. :param resource_group_name: The name of the resource group. @@ -338,27 +578,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,41 +602,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> 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-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,13 +640,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk encryption set. :param resource_group_name: The name of the resource group. @@ -436,15 +658,17 @@ def begin_delete( :type disk_encryption_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -458,21 +682,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -484,21 +701,24 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption 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 DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -506,35 +726,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,21 +768,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskEncryptionSetList"] + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: """Lists all the disk encryption sets under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskEncryptionSetList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] @@ -574,34 +793,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskEncryptionSetList', pipeline_response) + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -619,18 +833,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + @distributed_trace def list_associated_resources( self, - resource_group_name, # type: str - disk_encryption_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceUriList"] + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceUriList"]: """Lists all resources that are encrypted with this disk encryption set. :param resource_group_name: The name of the resource group. @@ -649,36 +864,33 @@ def list_associated_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_associated_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskEncryptionSetName': self._serialize.url("disk_encryption_set_name", disk_encryption_set_name, '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) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceUriList', pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -696,6 +908,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py index d09d6e2bdf49..6da394763c1b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py @@ -5,25 +5,191 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_restore_point_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DiskRestorePointOperations(object): """DiskRestorePointOperations operations. @@ -47,15 +213,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DiskRestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> "_models.DiskRestorePoint": """Get disk restorePoint resource. :param resource_group_name: The name of the resource group. @@ -78,29 +244,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,16 +270,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + @distributed_trace def list_by_restore_point( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskRestorePointList"] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskRestorePointList"]: """Lists diskRestorePoints under a vmRestorePoint. :param resource_group_name: The name of the resource group. @@ -135,8 +293,10 @@ def list_by_restore_point( belongs. :type vm_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiskRestorePointList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePointList] + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] @@ -144,37 +304,35 @@ def list_by_restore_point( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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_restore_point.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, '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) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskRestorePointList', pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,6 +350,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -199,47 +358,36 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -255,18 +403,20 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a diskRestorePoint. :param resource_group_name: The name of the resource group. @@ -284,15 +434,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2021_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -306,29 +459,21 @@ def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,45 +485,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> 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-04-01" - accept = "application/json" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,15 +526,16 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - vm_restore_point_name, # type: str - disk_restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a diskRestorePoint. :param resource_group_name: The name of the resource group. @@ -414,15 +550,17 @@ def begin_revoke_access( :type disk_restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -438,23 +576,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'vmRestorePointName': self._serialize.url("vm_restore_point_name", vm_restore_point_name, 'str'), - 'diskRestorePointName': self._serialize.url("disk_restore_point_name", disk_restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -466,4 +595,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py index a7bbba32e48f..6e617b049830 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class DisksOperations(object): """DisksOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'Disk') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.Disk" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Creates or updates a disk. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type disk: ~azure.mgmt.compute.v2021_04_01.models.Disk :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/disks/{diskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disk, 'DiskUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - disk_name, # type: str - disk, # type: "_models.DiskUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Disk"] + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: """Updates (patches) a disk. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type disk: ~azure.mgmt.compute.v2021_04_01.models.DiskUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Disk or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Disk', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Disk" + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": """Gets information about a disk. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a disk. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DiskList"] + **kwargs: Any + ) -> Iterable["_models.DiskList"]: """Lists all the disks under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiskList', pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - disk_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a disk. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2021_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> 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-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - disk_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a disk. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py index 8c9f207302d7..8caa617e9862 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_04_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py index deeb3c1f7c7e..463a853de833 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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_04_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py index 3477e8469048..688f299d04b5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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_04_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py index 3265322bb360..924324eaa818 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = _SERIALIZER.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +294,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +327,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +357,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +386,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +413,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,14 +436,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -264,29 +464,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,18 +489,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -319,34 +512,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,24 +552,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_04_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -389,35 +580,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +622,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py index c9db68669741..418ff6ad41fb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py @@ -5,25 +5,254 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RestorePointCollectionsOperations(object): """RestorePointCollectionsOperations operations. @@ -47,14 +276,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - parameters, # type: "_models.RestorePointCollection" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + parameters: "_models.RestorePointCollection", + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for more details. When updating a restore point collection, only tags may be modified. @@ -76,32 +305,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollection') - 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 @@ -119,16 +338,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - parameters, # type: "_models.RestorePointCollectionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + parameters: "_models.RestorePointCollectionUpdate", + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. @@ -147,32 +368,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - 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 @@ -186,41 +397,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any + ) -> 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-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +435,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the restore point collection. This operation will also delete all the contained restore points. @@ -249,15 +452,17 @@ def begin_delete( :type restore_point_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -271,21 +476,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -297,16 +495,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - expand=None, # type: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to get the restore point collection. :param resource_group_name: The name of the resource group. @@ -326,29 +525,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,21 +550,25 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorePointCollectionListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RestorePointCollectionListResult"]: """Gets the list of restore point collections 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 RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -384,35 +576,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,23 +618,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorePointCollectionListResult"] + **kwargs: Any + ) -> Iterable["_models.RestorePointCollectionListResult"]: """Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point collections. Do this till nextLink is not null to fetch all the restore point collections. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -454,34 +645,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,6 +685,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py index 4b756cae9dbe..926a575d4646 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py @@ -5,24 +5,147 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RestorePointsOperations(object): """RestorePointsOperations operations. @@ -48,45 +171,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - parameters, # type: "_models.RestorePoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: "_models.RestorePoint", + **kwargs: Any + ) -> "_models.RestorePoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePoint') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePoint') - 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 @@ -100,17 +212,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - parameters, # type: "_models.RestorePoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RestorePoint"] + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: "_models.RestorePoint", + **kwargs: Any + ) -> LROPoller["_models.RestorePoint"]: """The operation to create the restore point. Updating properties of an existing restore point is not allowed. @@ -124,15 +238,19 @@ def begin_create( :type parameters: ~azure.mgmt.compute.v2021_04_01.models.RestorePoint :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RestorePoint or the result of cls(response) + :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 RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +263,21 @@ def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,43 +289,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> 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-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,14 +328,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the restore point. :param resource_group_name: The name of the resource group. @@ -245,15 +347,17 @@ def begin_delete( :type restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -268,22 +372,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -295,16 +391,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> "_models.RestorePoint": """The operation to get the restore point. :param resource_group_name: The name of the resource group. @@ -323,28 +420,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,4 +445,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py index 481edadb02ec..6e60ec476564 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py @@ -5,25 +5,317 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -49,43 +341,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'Snapshot') - 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 @@ -103,16 +384,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Creates or updates a snapshot. :param resource_group_name: The name of the resource group. @@ -125,15 +408,18 @@ def begin_create_or_update( :type snapshot: ~azure.mgmt.compute.v2021_04_01.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +431,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,47 +457,37 @@ def get_long_running_output(pipeline_response): ) 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/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - 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 @@ -235,16 +505,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - snapshot_name, # type: str - snapshot, # type: "_models.SnapshotUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Updates (patches) a snapshot. :param resource_group_name: The name of the resource group. @@ -257,15 +529,18 @@ def begin_update( :type snapshot: ~azure.mgmt.compute.v2021_04_01.models.SnapshotUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,27 +552,21 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -309,15 +578,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Gets information about a snapshot. :param resource_group_name: The name of the resource group. @@ -336,27 +606,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,39 +630,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,13 +668,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a snapshot. :param resource_group_name: The name of the resource group. @@ -432,15 +686,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +710,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +729,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +752,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +794,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotList"] + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: """Lists snapshots under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +817,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotList', pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +857,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -622,43 +865,32 @@ def get_next(next_link=None): def _grant_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._grant_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - 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 @@ -674,16 +906,18 @@ def _grant_access_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + @distributed_trace def begin_grant_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - grant_access_data, # type: "_models.GrantAccessData" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AccessUri"] + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: """Grants access to a snapshot. :param resource_group_name: The name of the resource group. @@ -697,15 +931,18 @@ def begin_grant_access( :type grant_access_data: ~azure.mgmt.compute.v2021_04_01.models.GrantAccessData :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 AccessUri or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -717,27 +954,21 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AccessUri', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -749,39 +980,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore def _revoke_access_initial( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> 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-04-01" - - # Construct URL - url = self._revoke_access_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, '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 = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,13 +1017,14 @@ def _revoke_access_initial( _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + @distributed_trace def begin_revoke_access( self, - resource_group_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Revokes access to a snapshot. :param resource_group_name: The name of the resource group. @@ -811,15 +1035,17 @@ def begin_revoke_access( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,21 +1059,14 @@ def begin_revoke_access( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -859,4 +1078,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py index 6a66c755f109..9c5b5dc5c5e3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py @@ -5,23 +5,277 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_key_pair_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SshPublicKeysOperations(object): """SshPublicKeysOperations operations. @@ -45,17 +299,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + **kwargs: Any + ) -> 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_04_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -63,34 +319,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,25 +359,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_04_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -134,35 +388,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,19 +430,20 @@ def get_next(next_link=None): 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 + @distributed_trace def create( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -211,32 +462,22 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyResource') + + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,16 +495,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyUpdateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyUpdateResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -282,32 +525,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -321,15 +554,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> None: """Delete an SSH public key. :param resource_group_name: The name of the resource group. @@ -346,25 +581,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,13 +604,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Retrieves information about an SSH public key. :param resource_group_name: The name of the resource group. @@ -400,27 +628,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,15 +652,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def generate_key_pair( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyGenerateKeyPairResult" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_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. @@ -461,27 +681,17 @@ def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,4 +705,6 @@ def generate_key_pair( 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_04_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_usage_operations.py index 3febaeb03a28..6543f9ccded8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py index e900a00525d7..1a76f8679881 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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_04_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extensions_operations.py index 417189872aec..6ae3d3450ad1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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_04_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_edge_zone_operations.py index 0bab8f645f13..58a58bc51b41 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -5,22 +5,229 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + edge_zone: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + edge_zone: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesEdgeZoneOperations(object): """VirtualMachineImagesEdgeZoneOperations operations. @@ -44,17 +251,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image in an edge zone. :param location: The name of a supported Azure region. @@ -79,31 +286,21 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + + request = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -117,21 +314,23 @@ def get( 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 + + @distributed_trace 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"] + 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: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. @@ -162,36 +361,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,16 +391,18 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - edge_zone, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image offers for the specified location, edge zone and publisher. @@ -234,28 +422,18 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -269,15 +447,17 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - edge_zone, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + **kwargs: Any + ) -> 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. @@ -294,27 +474,17 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -328,17 +498,19 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace 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"] + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. @@ -360,29 +532,19 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,4 +558,6 @@ def list_skus( 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_04_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_operations.py index 96d8abc9c216..b9df3f165b1d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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_04_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_run_commands_operations.py index 44d5c376a663..e942fcbc67ae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_run_commands_operations.py @@ -5,25 +5,305 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -47,19 +327,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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_04_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -67,35 +349,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,18 +391,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -141,27 +420,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,49 +444,40 @@ def get( 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -235,17 +495,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the run command. :param resource_group_name: The name of the resource group. @@ -259,15 +521,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +547,21 @@ def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,49 +573,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -369,17 +619,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the run command. :param resource_group_name: The name of the resource group. @@ -392,15 +644,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -413,28 +670,21 @@ def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,43 +696,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,14 +735,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - run_command_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the run command. :param resource_group_name: The name of the resource group. @@ -513,15 +754,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -536,22 +779,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -563,17 +798,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the run command. :param resource_group_name: The name of the resource group. @@ -594,30 +830,19 @@ def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -631,16 +856,18 @@ def get_by_virtual_machine( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineRunCommandsListResult"]: """The operation to get all run commands of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -650,8 +877,10 @@ def list_by_virtual_machine( :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_04_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -659,38 +888,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -708,6 +934,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py index 146d04cc4b2f..45df238e6a8e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +320,24 @@ def begin_create_or_update( :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_04_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +350,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +376,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to update an extension. :param resource_group_name: The name of the resource group. @@ -265,18 +449,24 @@ def begin_update( :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_04_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -289,28 +479,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -322,41 +505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +544,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -387,15 +563,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +588,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,17 +607,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -468,30 +639,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +665,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -521,8 +683,10 @@ def list( :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_04_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -530,36 +694,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -577,6 +738,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index d384f894ee72..9acd93a4d80d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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-04-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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-04-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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-04-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index b091a144dd28..007f191157d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,24 +5,246 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMExtensionsOperations(object): """VirtualMachineScaleSetVMExtensionsOperations operations. @@ -48,47 +270,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,18 +317,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -130,18 +343,24 @@ def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +374,21 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +400,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +448,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -271,18 +474,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +505,21 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -330,45 +531,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,15 +572,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -402,15 +594,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,23 +620,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,18 +639,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMExtension": """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -488,31 +674,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,17 +701,19 @@ def get( 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 + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_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. @@ -557,30 +734,19 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,4 +760,6 @@ def list( 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_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 36164ed3f1e3..742adc8597d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,25 +5,247 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMRunCommandsOperations(object): """VirtualMachineScaleSetVMRunCommandsOperations operations. @@ -49,47 +271,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -107,18 +318,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -133,15 +346,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +373,21 @@ def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +399,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +447,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -273,15 +475,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,29 +502,21 @@ def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -329,45 +528,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,15 +569,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -401,15 +591,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +617,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -453,18 +636,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -487,31 +671,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -525,17 +698,19 @@ def get( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -547,8 +722,10 @@ def list( :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_04_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -556,39 +733,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +781,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py index ba664f842dc8..1b84eeb4cdc6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,615 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +639,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +682,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +701,22 @@ def begin_reimage( :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_04_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +729,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +752,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-04-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +791,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +811,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +836,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +855,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +894,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +915,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +940,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +959,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +1009,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +1035,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +1061,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,44 +1087,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,15 +1128,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -616,15 +1151,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -640,22 +1177,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -667,17 +1196,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -700,30 +1230,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -737,16 +1256,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -765,28 +1286,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -800,18 +1311,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -828,8 +1341,10 @@ def list( '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_04_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -837,42 +1352,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -890,6 +1402,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -897,40 +1410,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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-04-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -943,15 +1446,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -968,15 +1472,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -992,22 +1498,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1019,41 +1517,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1066,14 +1556,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1084,15 +1575,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1107,22 +1600,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1134,41 +1619,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1181,14 +1658,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1199,15 +1677,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1222,22 +1702,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1249,41 +1721,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1296,14 +1760,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1315,15 +1780,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1338,22 +1805,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1365,17 +1824,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_models.RetrieveBootDiagnosticsDataResult": """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. @@ -1399,30 +1859,19 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1436,41 +1885,34 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1483,14 +1925,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1501,15 +1944,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1524,22 +1969,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1551,16 +1988,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -1579,26 +2017,18 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1611,47 +2041,37 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1667,17 +2087,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1690,15 +2112,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1711,28 +2137,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1744,4 +2163,5 @@ def get_long_running_output(pipeline_response): ) 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_04_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_sets_operations.py index 40ba7a143034..665ec72a2995 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,938 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_set_orchestration_service_state_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -47,19 +960,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + location: str, + **kwargs: Any + ) -> 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_04_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -67,35 +982,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +1024,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1032,32 @@ def get_next(next_link=None): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -174,16 +1075,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -194,15 +1097,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,27 +1122,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -246,47 +1148,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -300,16 +1192,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -320,15 +1214,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -340,27 +1239,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,42 +1265,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -420,14 +1304,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -438,15 +1323,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -461,21 +1348,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -487,16 +1367,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -517,29 +1398,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -553,48 +1423,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -607,14 +1470,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -624,18 +1488,22 @@ def begin_deallocate( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -647,24 +1515,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -676,48 +1538,39 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-04-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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -730,15 +1583,16 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -746,21 +1600,25 @@ def begin_delete_instances( :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_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -773,24 +1631,18 @@ def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -802,15 +1654,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -827,27 +1680,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -861,21 +1704,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_04_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -883,35 +1730,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -929,23 +1772,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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_04_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -953,34 +1799,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -998,18 +1839,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -1018,8 +1860,10 @@ def list_skus( :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_04_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -1027,36 +1871,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1074,18 +1915,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1093,8 +1935,10 @@ def get_os_upgrade_history( :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_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1102,36 +1946,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1149,6 +1990,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1156,47 +1998,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1209,15 +2041,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1231,18 +2064,22 @@ def begin_power_off( 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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1255,24 +2092,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1284,48 +2115,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1338,14 +2161,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1353,18 +2177,22 @@ def begin_restart( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1376,24 +2204,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1405,48 +2227,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1459,14 +2273,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1474,18 +2289,22 @@ def begin_start( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1497,24 +2316,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1526,48 +2339,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1580,14 +2385,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1596,18 +2402,22 @@ def begin_redeploy( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1619,24 +2429,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1648,48 +2452,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1702,14 +2498,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1720,18 +2517,22 @@ def begin_perform_maintenance( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1743,24 +2544,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1772,45 +2567,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1823,14 +2610,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1838,18 +2626,22 @@ def begin_update_instances( :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_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1861,24 +2653,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1890,48 +2676,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1944,14 +2722,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1961,18 +2740,22 @@ def begin_reimage( :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_04_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1984,24 +2767,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2013,48 +2790,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2067,14 +2836,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -2083,18 +2853,22 @@ def begin_reimage_all( :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2106,24 +2880,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2135,16 +2903,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2165,28 +2934,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2200,16 +2959,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2217,7 +2978,8 @@ def convert_to_single_placement_group( :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_04_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2021_04_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 @@ -2228,30 +2990,22 @@ def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2264,43 +3018,35 @@ def convert_to_single_placement_group( 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2313,14 +3059,15 @@ def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. @@ -2331,15 +3078,18 @@ def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2351,24 +3101,18 @@ def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2380,4 +3124,5 @@ def get_long_running_output(pipeline_response): ) 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_04_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_sizes_operations.py index bb218b058cd5..76c4f2ba95a0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py index 8dbcd15ca220..92d456791756 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py @@ -5,25 +5,907 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_assess_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +929,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +951,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +993,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1001,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +1042,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +1065,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +1090,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +1116,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +1164,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. @@ -324,15 +1187,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -344,27 +1211,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,47 +1237,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -430,16 +1281,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -450,15 +1303,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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_04_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -470,27 +1327,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -502,42 +1353,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-04-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,34 +1392,36 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -592,21 +1436,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -618,16 +1455,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_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. @@ -649,29 +1487,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -685,15 +1512,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -710,27 +1539,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -744,39 +1563,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -789,13 +1601,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -805,15 +1618,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -827,21 +1642,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -853,39 +1661,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -898,13 +1698,14 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -914,15 +1715,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -936,21 +1739,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -962,15 +1758,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 @@ -992,25 +1789,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1023,20 +1812,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1044,35 +1836,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1090,17 +1878,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - status_only=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + status_only: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -1108,8 +1897,10 @@ def list_all( 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_04_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1117,36 +1908,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1164,18 +1950,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1184,8 +1971,10 @@ def list_available_sizes( :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_04_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1193,36 +1982,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1240,6 +2026,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1247,38 +2034,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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-04-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1291,14 +2068,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1312,15 +2090,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1335,21 +2115,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1361,41 +2134,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1408,13 +2171,14 @@ def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace def begin_reapply( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to reapply a virtual machine's state. :param resource_group_name: The name of the resource group. @@ -1423,15 +2187,17 @@ def begin_reapply( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1445,21 +2211,14 @@ def begin_reapply( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1471,39 +2230,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1516,13 +2267,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1531,15 +2283,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1553,21 +2307,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1579,39 +2326,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1624,13 +2363,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1639,15 +2379,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1661,21 +2403,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1687,39 +2422,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1732,13 +2459,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1747,15 +2475,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1769,21 +2499,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1795,48 +2518,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1849,14 +2564,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1867,15 +2583,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1887,24 +2606,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1916,16 +2629,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_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. @@ -1946,29 +2660,18 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1982,39 +2685,32 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2027,13 +2723,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -2042,15 +2739,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2064,21 +2763,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2090,15 +2782,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """The operation to simulate the eviction of spot virtual machine. :param resource_group_name: The name of the resource group. @@ -2115,25 +2808,17 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2146,39 +2831,29 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-04-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2194,15 +2869,17 @@ def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace def begin_assess_patches( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineAssessPatchesResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineAssessPatchesResult"]: """Assess patches on the VM. :param resource_group_name: The name of the resource group. @@ -2211,15 +2888,19 @@ def begin_assess_patches( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2233,24 +2914,17 @@ def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2262,47 +2936,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2318,16 +2982,18 @@ def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineInstallPatchesResult"]: """Installs patches on the VM. :param resource_group_name: The name of the resource group. @@ -2335,18 +3001,24 @@ def begin_install_patches( :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_04_01.models.VirtualMachineInstallPatchesParameters + :type install_patches_input: + ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_04_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2358,27 +3030,21 @@ def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2390,47 +3056,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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-04-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2446,16 +3102,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2466,15 +3124,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_04_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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_04_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2486,27 +3148,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2518,4 +3174,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/__init__.py index da8181c02bd2..fd39b8a6c901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ComputeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py index 6f72e91058d9..91d892a82f1e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py @@ -6,116 +6,98 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, CommunityGalleriesOperations, CommunityGalleryImageVersionsOperations, CommunityGalleryImagesOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, GallerySharingProfileOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, ResourceSkusOperations, RestorePointCollectionsOperations, RestorePointsOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ComputeManagementClientConfiguration -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 RestorePointCollectionsOperations -from .operations import RestorePointsOperations -from .operations import CapacityReservationGroupsOperations -from .operations import CapacityReservationsOperations -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 .operations import ResourceSkusOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import GallerySharingProfileOperations -from .operations import SharedGalleriesOperations -from .operations import SharedGalleryImagesOperations -from .operations import SharedGalleryImageVersionsOperations -from .operations import CommunityGalleriesOperations -from .operations import CommunityGalleryImagesOperations -from .operations import CommunityGalleryImageVersionsOperations -from . import models - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2021_07_01.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2021_07_01.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2021_07_01.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2021_07_01.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2021_07_01.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2021_07_01.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2021_07_01.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations :vartype dedicated_hosts: azure.mgmt.compute.v2021_07_01.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2021_07_01.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineImagesOperations :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineImagesEdgeZoneOperations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineImagesEdgeZoneOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2021_07_01.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2021_07_01.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2021_07_01.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations - :vartype restore_point_collections: azure.mgmt.compute.v2021_07_01.operations.RestorePointCollectionsOperations + :vartype restore_point_collections: + azure.mgmt.compute.v2021_07_01.operations.RestorePointCollectionsOperations :ivar restore_points: RestorePointsOperations operations :vartype restore_points: azure.mgmt.compute.v2021_07_01.operations.RestorePointsOperations :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: azure.mgmt.compute.v2021_07_01.operations.CapacityReservationGroupsOperations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2021_07_01.operations.CapacityReservationGroupsOperations :ivar capacity_reservations: CapacityReservationsOperations operations - :vartype capacity_reservations: azure.mgmt.compute.v2021_07_01.operations.CapacityReservationsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype capacity_reservations: + azure.mgmt.compute.v2021_07_01.operations.CapacityReservationsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2021_07_01.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2021_07_01.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2021_07_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_07_01.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2021_07_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_07_01.operations.VirtualMachineScaleSetVMRunCommandsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2021_07_01.operations.ResourceSkusOperations :ivar galleries: GalleriesOperations operations @@ -123,147 +105,125 @@ class ComputeManagementClient(object): :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2021_07_01.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2021_07_01.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2021_07_01.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2021_07_01.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2021_07_01.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2021_07_01.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2021_07_01.operations.GalleryApplicationVersionsOperations :ivar gallery_sharing_profile: GallerySharingProfileOperations operations - :vartype gallery_sharing_profile: azure.mgmt.compute.v2021_07_01.operations.GallerySharingProfileOperations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2021_07_01.operations.GallerySharingProfileOperations :ivar shared_galleries: SharedGalleriesOperations operations :vartype shared_galleries: azure.mgmt.compute.v2021_07_01.operations.SharedGalleriesOperations :ivar shared_gallery_images: SharedGalleryImagesOperations operations - :vartype shared_gallery_images: azure.mgmt.compute.v2021_07_01.operations.SharedGalleryImagesOperations + :vartype shared_gallery_images: + azure.mgmt.compute.v2021_07_01.operations.SharedGalleryImagesOperations :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations - :vartype shared_gallery_image_versions: azure.mgmt.compute.v2021_07_01.operations.SharedGalleryImageVersionsOperations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2021_07_01.operations.SharedGalleryImageVersionsOperations :ivar community_galleries: CommunityGalleriesOperations operations - :vartype community_galleries: azure.mgmt.compute.v2021_07_01.operations.CommunityGalleriesOperations + :vartype community_galleries: + azure.mgmt.compute.v2021_07_01.operations.CommunityGalleriesOperations :ivar community_gallery_images: CommunityGalleryImagesOperations operations - :vartype community_gallery_images: azure.mgmt.compute.v2021_07_01.operations.CommunityGalleryImagesOperations + :vartype community_gallery_images: + azure.mgmt.compute.v2021_07_01.operations.CommunityGalleryImagesOperations :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations - :vartype community_gallery_image_versions: azure.mgmt.compute.v2021_07_01.operations.CommunityGalleryImageVersionsOperations + :vartype community_gallery_image_versions: + azure.mgmt.compute.v2021_07_01.operations.CommunityGalleryImageVersionsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.restore_point_collections = RestorePointCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservation_groups = CapacityReservationGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservations = CapacityReservationsOperations(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) + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_sharing_profile = GallerySharingProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_images = SharedGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_galleries = CommunityGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_images = CommunityGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. - 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.restore_point_collections = RestorePointCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservations = CapacityReservationsOperations( - 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) - self.resource_skus = ResourceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_sharing_profile = GallerySharingProfileOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_galleries = SharedGalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_images = SharedGalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.community_galleries = CommunityGalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.community_gallery_images = CommunityGalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse - """Runs the network request through the client's chained policies. + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py index 52e39da71b59..0ed0f8a690ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ComputeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json index 6fc3958fc14b..a62f3b7b26e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py index 2960d05ed5c3..88e0f16a1883 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.1.0" +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/__init__.py index 9e9459635989..9c044a7dd939 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._compute_management_client import ComputeManagementClient __all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py index 32c2c15af904..93414748e5c9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py @@ -6,114 +6,100 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, CommunityGalleriesOperations, CommunityGalleryImageVersionsOperations, CommunityGalleryImagesOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, GallerySharingProfileOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, ResourceSkusOperations, RestorePointCollectionsOperations, RestorePointsOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ComputeManagementClientConfiguration -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 RestorePointCollectionsOperations -from .operations import RestorePointsOperations -from .operations import CapacityReservationGroupsOperations -from .operations import CapacityReservationsOperations -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 .operations import ResourceSkusOperations -from .operations import GalleriesOperations -from .operations import GalleryImagesOperations -from .operations import GalleryImageVersionsOperations -from .operations import GalleryApplicationsOperations -from .operations import GalleryApplicationVersionsOperations -from .operations import GallerySharingProfileOperations -from .operations import SharedGalleriesOperations -from .operations import SharedGalleryImagesOperations -from .operations import SharedGalleryImageVersionsOperations -from .operations import CommunityGalleriesOperations -from .operations import CommunityGalleryImagesOperations -from .operations import CommunityGalleryImageVersionsOperations -from .. import models - - -class ComputeManagementClient(object): +class ComputeManagementClient: """Compute Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2021_07_01.aio.operations.Operations :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: azure.mgmt.compute.v2021_07_01.aio.operations.AvailabilitySetsOperations + :vartype availability_sets: + azure.mgmt.compute.v2021_07_01.aio.operations.AvailabilitySetsOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations - :vartype proximity_placement_groups: azure.mgmt.compute.v2021_07_01.aio.operations.ProximityPlacementGroupsOperations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2021_07_01.aio.operations.ProximityPlacementGroupsOperations :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: azure.mgmt.compute.v2021_07_01.aio.operations.DedicatedHostGroupsOperations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2021_07_01.aio.operations.DedicatedHostGroupsOperations :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2021_07_01.aio.operations.DedicatedHostsOperations + :vartype dedicated_hosts: + azure.mgmt.compute.v2021_07_01.aio.operations.DedicatedHostsOperations :ivar ssh_public_keys: SshPublicKeysOperations operations :vartype ssh_public_keys: azure.mgmt.compute.v2021_07_01.aio.operations.SshPublicKeysOperations :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineExtensionImagesOperations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineExtensionImagesOperations :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineExtensionsOperations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineImagesOperations + :vartype virtual_machine_images: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineImagesOperations :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineImagesEdgeZoneOperations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineImagesEdgeZoneOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2021_07_01.aio.operations.UsageOperations :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachinesOperations + :vartype virtual_machines: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachinesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations - :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetsOperations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetsOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineSizesOperations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineSizesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.compute.v2021_07_01.aio.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations - :vartype restore_point_collections: azure.mgmt.compute.v2021_07_01.aio.operations.RestorePointCollectionsOperations + :vartype restore_point_collections: + azure.mgmt.compute.v2021_07_01.aio.operations.RestorePointCollectionsOperations :ivar restore_points: RestorePointsOperations operations :vartype restore_points: azure.mgmt.compute.v2021_07_01.aio.operations.RestorePointsOperations :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: azure.mgmt.compute.v2021_07_01.aio.operations.CapacityReservationGroupsOperations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2021_07_01.aio.operations.CapacityReservationGroupsOperations :ivar capacity_reservations: CapacityReservationsOperations operations - :vartype capacity_reservations: azure.mgmt.compute.v2021_07_01.aio.operations.CapacityReservationsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations - :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations - :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :vartype capacity_reservations: + azure.mgmt.compute.v2021_07_01.aio.operations.CapacityReservationsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetVMsOperations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2021_07_01.aio.operations.VirtualMachineScaleSetVMsOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.compute.v2021_07_01.aio.operations.LogAnalyticsOperations :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: azure.mgmt.compute.v2021_07_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_07_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2021_07_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_07_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.compute.v2021_07_01.aio.operations.ResourceSkusOperations :ivar galleries: GalleriesOperations operations @@ -121,145 +107,126 @@ class ComputeManagementClient(object): :ivar gallery_images: GalleryImagesOperations operations :vartype gallery_images: azure.mgmt.compute.v2021_07_01.aio.operations.GalleryImagesOperations :ivar gallery_image_versions: GalleryImageVersionsOperations operations - :vartype gallery_image_versions: azure.mgmt.compute.v2021_07_01.aio.operations.GalleryImageVersionsOperations + :vartype gallery_image_versions: + azure.mgmt.compute.v2021_07_01.aio.operations.GalleryImageVersionsOperations :ivar gallery_applications: GalleryApplicationsOperations operations - :vartype gallery_applications: azure.mgmt.compute.v2021_07_01.aio.operations.GalleryApplicationsOperations + :vartype gallery_applications: + azure.mgmt.compute.v2021_07_01.aio.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations - :vartype gallery_application_versions: azure.mgmt.compute.v2021_07_01.aio.operations.GalleryApplicationVersionsOperations + :vartype gallery_application_versions: + azure.mgmt.compute.v2021_07_01.aio.operations.GalleryApplicationVersionsOperations :ivar gallery_sharing_profile: GallerySharingProfileOperations operations - :vartype gallery_sharing_profile: azure.mgmt.compute.v2021_07_01.aio.operations.GallerySharingProfileOperations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2021_07_01.aio.operations.GallerySharingProfileOperations :ivar shared_galleries: SharedGalleriesOperations operations - :vartype shared_galleries: azure.mgmt.compute.v2021_07_01.aio.operations.SharedGalleriesOperations + :vartype shared_galleries: + azure.mgmt.compute.v2021_07_01.aio.operations.SharedGalleriesOperations :ivar shared_gallery_images: SharedGalleryImagesOperations operations - :vartype shared_gallery_images: azure.mgmt.compute.v2021_07_01.aio.operations.SharedGalleryImagesOperations + :vartype shared_gallery_images: + azure.mgmt.compute.v2021_07_01.aio.operations.SharedGalleryImagesOperations :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations - :vartype shared_gallery_image_versions: azure.mgmt.compute.v2021_07_01.aio.operations.SharedGalleryImageVersionsOperations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2021_07_01.aio.operations.SharedGalleryImageVersionsOperations :ivar community_galleries: CommunityGalleriesOperations operations - :vartype community_galleries: azure.mgmt.compute.v2021_07_01.aio.operations.CommunityGalleriesOperations + :vartype community_galleries: + azure.mgmt.compute.v2021_07_01.aio.operations.CommunityGalleriesOperations :ivar community_gallery_images: CommunityGalleryImagesOperations operations - :vartype community_gallery_images: azure.mgmt.compute.v2021_07_01.aio.operations.CommunityGalleryImagesOperations + :vartype community_gallery_images: + azure.mgmt.compute.v2021_07_01.aio.operations.CommunityGalleryImagesOperations :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations - :vartype community_gallery_image_versions: azure.mgmt.compute.v2021_07_01.aio.operations.CommunityGalleryImageVersionsOperations + :vartype community_gallery_image_versions: + azure.mgmt.compute.v2021_07_01.aio.operations.CommunityGalleryImageVersionsOperations :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. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.restore_point_collections = RestorePointCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservation_groups = CapacityReservationGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.capacity_reservations = CapacityReservationsOperations(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) + self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_sharing_profile = GallerySharingProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_images = SharedGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_galleries = CommunityGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_images = CommunityGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations(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.restore_point_collections = RestorePointCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capacity_reservations = CapacityReservationsOperations( - 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) - self.resource_skus = ResourceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.galleries = GalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_image_versions = GalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_applications = GalleryApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_application_versions = GalleryApplicationVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gallery_sharing_profile = GallerySharingProfileOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_galleries = SharedGalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_images = SharedGalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.community_galleries = CommunityGalleriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.community_gallery_images = CommunityGalleryImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py index cbb34c44a751..c6e581dc9a0a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ComputeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py index c27ba7dcb282..e152577543ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._availability_sets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_available_sizes_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,32 +131,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +160,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,25 +187,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +210,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,27 +234,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,8 +258,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, @@ -295,8 +274,10 @@ def list_by_subscription( '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_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -304,36 +285,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,11 +327,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,8 +344,10 @@ def list( :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_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -375,35 +355,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -440,8 +418,10 @@ def list_available_sizes( :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_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -449,36 +429,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,6 +473,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py index 77098cdfd6a6..cdb7cfcf62f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._capacity_reservation_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroup') - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -139,32 +138,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') - 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 @@ -178,8 +167,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -205,27 +197,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,6 +220,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -255,7 +239,8 @@ async def get( the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservationGroup, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroup @@ -266,29 +251,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +276,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -318,10 +295,13 @@ def list_by_resource_group( :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -329,37 +309,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -377,11 +353,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups'} # type: ignore + @distributed_trace def list_by_subscription( self, expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, @@ -393,10 +371,13 @@ def list_by_subscription( :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -404,36 +385,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -451,6 +427,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py index e98cfe291c0f..38cfd6b433e3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._capacity_reservations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_capacity_reservation_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservation') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservation') - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -124,15 +122,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservation :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +148,21 @@ async def begin_create_or_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +174,7 @@ def get_long_running_output(pipeline_response): ) 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore async def _update_initial( @@ -193,33 +190,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationUpdate') - 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 @@ -235,8 +222,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,15 +247,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,28 +273,21 @@ async def begin_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -311,6 +299,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore async def _delete_initial( @@ -325,28 +314,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -359,6 +338,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -378,15 +359,17 @@ async def begin_delete( :type capacity_reservation_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -401,22 +384,14 @@ async def begin_delete( 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -428,8 +403,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -449,7 +426,8 @@ async def get( :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservation, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservation @@ -460,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -497,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def list_by_capacity_reservation_group( self, resource_group_name: str, @@ -513,8 +483,10 @@ def list_by_capacity_reservation_group( :param capacity_reservation_group_name: The name of the capacity reservation group. :type capacity_reservation_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 CapacityReservationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationListResult] + :return: An iterator like instance of either CapacityReservationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] @@ -522,36 +494,33 @@ def list_by_capacity_reservation_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_capacity_reservation_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_capacity_reservation_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -569,6 +538,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py index a633b233dcad..390843086dc0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._community_galleries_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -62,27 +67,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'publicGalleryName': self._serialize.url("public_gallery_name", public_gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py index 0d0ccc304fba..3920762372d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._community_gallery_image_versions_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,29 +76,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'publicGalleryName': self._serialize.url("public_gallery_name", public_gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -107,4 +102,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py index ae314e8f14ff..1f18facd1572 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._community_gallery_images_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -65,28 +70,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'publicGalleryName': self._serialize.url("public_gallery_name", public_gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,4 +95,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py index 94b85750b031..f2d483f50619 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_host_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +166,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,25 +193,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,6 +216,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -259,29 +245,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +270,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -308,8 +286,10 @@ def list_by_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 DedicatedHostGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -317,35 +297,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -363,11 +339,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -376,8 +354,10 @@ def list_by_subscription( 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_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -385,34 +365,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,6 +405,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py index 57290ff28276..afeb1578fa1b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dedicated_hosts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_host_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -122,15 +120,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,28 +146,21 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -176,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -191,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -231,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -253,15 +243,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,28 +269,21 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +295,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -321,26 +310,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,6 +334,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +353,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,22 +378,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,8 +397,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, resource_group_name: str, @@ -505,8 +476,10 @@ def list_by_host_group( :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_07_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -514,36 +487,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -561,6 +531,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py index ae2de09d8440..3ec55ca6eb51 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._galleries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'Gallery') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -101,8 +96,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,15 +119,19 @@ async def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2021_07_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +143,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -173,6 +169,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore async def _update_initial( @@ -187,32 +184,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -226,8 +213,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -246,15 +236,19 @@ async def begin_update( :type gallery: ~azure.mgmt.compute.v2021_07_01.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Gallery or the result of cls(response) + :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 Gallery or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -266,27 +260,21 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -298,8 +286,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -325,29 +315,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + select=select, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -361,8 +340,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -374,27 +355,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -407,6 +378,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -421,15 +394,17 @@ async def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,21 +418,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +437,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -482,7 +452,8 @@ def list_by_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 GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -490,35 +461,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -536,11 +503,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,7 +518,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] @@ -557,34 +527,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -602,6 +567,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py index e824f5c989fd..24de30b0dd70 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_application_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_application_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -133,18 +131,24 @@ async def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +162,21 @@ async def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +188,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +205,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -249,8 +236,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -277,18 +267,24 @@ async def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +298,21 @@ async def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +324,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -372,31 +362,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,8 +389,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -425,29 +406,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -460,6 +431,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -483,15 +456,17 @@ async def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -507,23 +482,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -535,8 +501,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, resource_group_name: str, @@ -555,8 +523,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -564,37 +534,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,6 +580,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py index ffb0811189df..7a932bf8ef4b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -129,15 +127,20 @@ async def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +153,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +179,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore async def _update_initial( @@ -198,33 +195,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -238,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,15 +253,20 @@ async def begin_update( :type gallery_application: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +279,21 @@ async def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,8 +305,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -346,28 +336,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -381,8 +361,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -395,28 +377,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -429,6 +401,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -447,15 +421,17 @@ async def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -470,22 +446,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -497,8 +465,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -513,8 +483,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -522,36 +494,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -569,6 +538,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py index f71f1ba39c37..15f19367606e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_image_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_image_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -105,8 +100,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -136,15 +134,20 @@ async def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,29 +161,21 @@ async def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -192,6 +187,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore async def _update_initial( @@ -208,34 +204,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -249,8 +235,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -280,15 +269,20 @@ async def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +296,21 @@ async def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -336,8 +322,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -371,31 +359,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -409,8 +386,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -424,29 +403,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -459,6 +428,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -481,15 +452,17 @@ async def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -505,23 +478,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -533,8 +497,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, resource_group_name: str, @@ -553,8 +519,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -562,37 +530,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,6 +576,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py index e2dd6cce2b52..783c9dd35522 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -103,8 +98,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -128,15 +126,19 @@ async def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +151,21 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -182,6 +177,7 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore async def _update_initial( @@ -197,33 +193,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -237,8 +223,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -262,15 +251,19 @@ async def begin_update( :type gallery_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +276,21 @@ async def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,8 +302,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -344,28 +332,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -379,8 +357,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -393,28 +373,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -427,6 +397,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -445,15 +417,17 @@ async def begin_delete( :type gallery_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -468,22 +442,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, resource_group_name: str, @@ -512,7 +480,8 @@ def list_by_gallery( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryImageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] @@ -520,36 +489,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -567,6 +533,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py index 9d1f2793bd35..3dfe38f51bd0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gallery_sharing_profile_operations import build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,32 +58,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(sharing_update, 'SharingUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sharing_update, 'SharingUpdate') - 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 @@ -97,8 +91,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -116,15 +113,20 @@ async def begin_update( :type sharing_update: ~azure.mgmt.compute.v2021_07_01.models.SharingUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SharingUpdate or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: + :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 SharingUpdate or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.SharingUpdate] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -136,27 +138,21 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, sharing_update=sharing_update, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SharingUpdate', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -168,4 +164,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py index cdcbea12d166..d6b528d2c88a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Image') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,6 +164,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -183,32 +179,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,8 +212,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -245,15 +234,18 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -265,27 +257,21 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -297,6 +283,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -310,25 +297,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -341,6 +320,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -355,15 +336,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,21 +360,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -403,8 +379,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -430,29 +408,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,8 +433,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -479,7 +449,8 @@ def list_by_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_07_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -487,35 +458,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,11 +500,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list( self, **kwargs: Any @@ -547,7 +516,8 @@ def list( :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_07_01.models.ImageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] @@ -555,34 +525,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -600,6 +565,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py index 419548d5029d..823d8b396d82 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._log_analytics_operations import build_export_request_rate_by_interval_request_initial, build_export_throttled_requests_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,31 +57,21 @@ async def _export_request_rate_by_interval_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -93,8 +87,11 @@ async def _export_request_rate_by_interval_initial( 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 + + @distributed_trace_async async def begin_export_request_rate_by_interval( self, location: str, @@ -110,15 +107,20 @@ async def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -129,26 +131,21 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -160,6 +157,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -173,31 +171,21 @@ async def _export_throttled_requests_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') - # 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') + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,8 +201,11 @@ async def _export_throttled_requests_initial( 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 + + @distributed_trace_async async def begin_export_throttled_requests( self, location: str, @@ -230,15 +221,20 @@ async def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -249,26 +245,21 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -280,4 +271,5 @@ def get_long_running_output(pipeline_response): ) 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_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py index 840df1ad2e3a..274bb081b19a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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_07_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py index 97ca55d12cb3..b771671f0307 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._proximity_placement_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -66,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -136,32 +135,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -199,25 +191,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -230,6 +214,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -256,29 +242,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +267,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,8 +279,10 @@ def list_by_subscription( """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_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -310,34 +290,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,11 +330,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -370,8 +347,10 @@ def list_by_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_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -379,35 +358,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,6 +400,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py index 7eb7e076b716..2e2a91a84e80 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._resource_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, filter: Optional[str] = None, @@ -57,7 +63,8 @@ def list( :type include_extended_locations: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ResourceSkusResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] @@ -65,38 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include_extended_locations is not None: - query_parameters['includeExtendedLocations'] = self._serialize.query("include_extended_locations", include_extended_locations, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,6 +116,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py index ee26fd32be4d..bed047b8f6ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restore_point_collections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_all_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -71,32 +77,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollection') - 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 @@ -114,8 +110,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -141,32 +140,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - 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 @@ -180,8 +169,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -193,27 +184,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -226,6 +207,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -241,15 +224,17 @@ async def begin_delete( :type restore_point_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -263,21 +248,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -289,8 +267,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -317,29 +297,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -353,8 +322,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -365,8 +337,10 @@ def list( :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 RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -374,35 +348,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -420,11 +390,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -434,8 +406,10 @@ def list_all( to fetch all the restore point collections. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -443,34 +417,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -488,6 +457,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py index e674eb222e99..25251ceaaad4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restore_points_operations import build_create_request_initial, build_delete_request_initial, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RestorePoint') - # 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') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePoint') - 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 @@ -95,8 +89,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -118,15 +115,19 @@ async def begin_create( :type parameters: ~azure.mgmt.compute.v2021_07_01.models.RestorePoint :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of cls(response) + :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 RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,28 +140,21 @@ async def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -172,6 +166,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore async def _delete_initial( @@ -186,28 +181,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,6 +205,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -237,15 +224,17 @@ async def begin_delete( :type restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -260,22 +249,14 @@ async def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -287,8 +268,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -314,28 +297,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -349,4 +322,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py index c42364e81427..1de63639fd23 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shared_galleries_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -56,7 +62,8 @@ def list( :type shared_to: str or ~azure.mgmt.compute.v2021_07_01.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] @@ -64,37 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'location': self._serialize.url("location", location, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryList', pipeline_response) + deserialized = self._deserialize("SharedGalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,11 +115,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -139,27 +144,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -173,4 +168,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py index b5b204f2ff18..63f59eee3b02 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shared_gallery_image_versions_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -62,8 +68,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2021_07_01.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersionList] + :return: An iterator like instance of either SharedGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] @@ -71,39 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,11 +127,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -158,29 +166,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -194,4 +192,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py index 93eb9499fde4..1e6e8c2254e9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shared_gallery_images_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -58,8 +64,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2021_07_01.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageList] + :return: An iterator like instance of either SharedGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] @@ -67,38 +75,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,11 +121,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -147,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -182,4 +179,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py index 660fd6f2667a..35852155172a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._ssh_public_keys_operations import build_create_request, build_delete_request, build_generate_key_pair_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -49,8 +55,10 @@ def list_by_subscription( 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_07_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -58,34 +66,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,11 +106,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -119,8 +124,10 @@ def list_by_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 SshPublicKeysGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -128,35 +135,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,11 +177,13 @@ async def get_next(next_link=None): 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 + @distributed_trace_async async def create( self, resource_group_name: str, @@ -204,32 +209,22 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyResource') - # 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') + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,8 +242,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -274,32 +272,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,8 +301,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -337,25 +328,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -368,6 +351,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -390,27 +375,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +399,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace_async async def generate_key_pair( self, resource_group_name: str, @@ -450,27 +428,17 @@ async def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,4 +452,6 @@ async def generate_key_pair( 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_07_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_usage_operations.py index 3edc89297843..393d5889c69d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,7 +59,8 @@ def list( :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_07_01.models.ListUsagesResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] @@ -61,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py index 95f503f8326f..978946591b0b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extension_images_operations import build_get_request, build_list_types_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -68,29 +73,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -104,8 +99,11 @@ async def get( 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 + + @distributed_trace_async async def list_types( self, location: str, @@ -128,27 +126,17 @@ async def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +150,11 @@ async def list_types( 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 + + @distributed_trace_async async def list_versions( self, location: str, @@ -198,34 +189,21 @@ async def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,4 +217,6 @@ async def list_versions( 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_07_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extensions_operations.py index 3f7fbe8b9c7e..a6f8221e8c1a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,33 +59,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +93,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -123,15 +120,20 @@ async def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,28 +146,21 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,6 +172,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -192,33 +188,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -232,8 +218,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -252,18 +241,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,28 +271,21 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,6 +297,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -323,26 +312,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -355,6 +336,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +355,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +380,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -452,30 +431,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -489,8 +457,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -516,29 +487,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -552,4 +512,6 @@ async def list( 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_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index 9eee834806dd..6e3118b4235b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_edge_zone_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -74,31 +79,21 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -112,8 +107,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -156,36 +154,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,8 +184,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -227,28 +215,18 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -262,8 +240,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -286,27 +267,17 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -320,8 +291,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -351,29 +325,19 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -387,4 +351,6 @@ async def list_skus( 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_07_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_operations.py index 639ecf2de941..ed2bf7f9714b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_images_operations import build_get_request, build_list_offers_request, build_list_publishers_request, build_list_request, build_list_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -71,30 +76,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +103,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, location: str, @@ -148,35 +146,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +175,11 @@ async def list( 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 + + @distributed_trace_async async def list_offers( self, location: str, @@ -214,27 +202,17 @@ async def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -248,8 +226,11 @@ async def list_offers( 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 + + @distributed_trace_async async def list_publishers( self, location: str, @@ -269,26 +250,16 @@ async def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -302,8 +273,11 @@ async def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace_async async def list_skus( self, location: str, @@ -329,28 +303,18 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,4 +328,6 @@ async def list_skus( 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_07_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_run_commands_operations.py index 25bca6d48e9d..b6a35558271a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_by_virtual_machine_request, build_get_request, build_list_by_virtual_machine_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,8 +59,10 @@ def list( :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_07_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,11 +112,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -135,27 +141,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -169,8 +165,10 @@ async def get( 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, @@ -184,33 +182,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -228,8 +216,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -251,15 +242,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,28 +268,21 @@ async def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,6 +294,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -320,33 +310,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,8 +340,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -382,15 +365,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -403,28 +391,21 @@ async def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,6 +417,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -450,28 +432,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -484,6 +456,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -501,15 +475,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -524,22 +500,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -551,8 +519,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_by_virtual_machine( self, resource_group_name: str, @@ -581,30 +551,19 @@ async def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -618,8 +577,11 @@ async def get_by_virtual_machine( 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 + + @distributed_trace def list_by_virtual_machine( self, resource_group_name: str, @@ -636,8 +598,10 @@ def list_by_virtual_machine( :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_07_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -645,38 +609,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +655,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 11d1321e10ff..77b792eba84e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,33 +61,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -121,18 +119,24 @@ async def begin_create_or_update( :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_07_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +149,21 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,6 +175,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -193,33 +191,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +225,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -257,18 +248,24 @@ async def begin_update( :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_07_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,28 +278,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -314,6 +304,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -328,26 +319,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -360,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +362,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +387,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,8 +406,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -457,30 +438,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -494,8 +464,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -509,8 +482,10 @@ def list( :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_07_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -518,36 +493,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -565,6 +537,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 9a80b294eea5..649895264bd2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_rolling_upgrades_operations import build_cancel_request_initial, build_get_latest_request, build_start_extension_upgrade_request_initial, build_start_os_upgrade_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,25 +57,17 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,6 +80,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -98,15 +96,17 @@ async def begin_cancel( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -120,21 +120,14 @@ async def begin_cancel( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -146,6 +139,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -159,25 +153,17 @@ async def _start_os_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,6 +176,8 @@ async def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_os_upgrade( self, resource_group_name: str, @@ -206,15 +194,17 @@ async def begin_start_os_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,21 +218,14 @@ async def begin_start_os_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +237,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -267,25 +251,17 @@ async def _start_extension_upgrade_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,6 +274,8 @@ async def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace_async async def begin_start_extension_upgrade( self, resource_group_name: str, @@ -314,15 +292,17 @@ async def begin_start_extension_upgrade( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +316,14 @@ async def begin_start_extension_upgrade( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_latest( self, resource_group_name: str, @@ -386,27 +361,17 @@ async def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,4 +385,6 @@ async def get_latest( 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_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 4ca18857a971..4c1f77747846 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_extensions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -101,8 +95,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -124,18 +121,24 @@ async def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -263,18 +252,24 @@ async def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,29 +283,21 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -322,6 +309,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -337,29 +325,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -372,6 +350,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +372,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,23 +398,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,8 +417,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -477,31 +452,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -515,8 +479,11 @@ async def get( 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 + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -545,30 +512,19 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -582,4 +538,6 @@ async def list( 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_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 0fa80cba3412..cde5eba345d2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vm_run_commands_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,34 +62,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -102,8 +97,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +125,20 @@ async def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,29 +152,21 @@ async def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -183,6 +178,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -199,34 +195,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -240,8 +226,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -265,15 +254,20 @@ async def begin_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,29 +281,21 @@ async def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -321,6 +307,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -336,29 +323,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -371,6 +348,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -391,15 +370,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,23 +396,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -443,8 +415,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -476,31 +450,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -514,8 +477,11 @@ async def get( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -535,8 +501,10 @@ def list( :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_07_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -544,39 +512,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -594,6 +560,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 7aded4f51d54..df619d9c212c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_set_vms_operations import build_deallocate_request_initial, build_delete_request_initial, build_get_instance_view_request, build_get_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +61,26 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,6 +93,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -113,18 +112,22 @@ async def begin_reimage( :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_07_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,25 +140,18 @@ async def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,6 +163,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -181,26 +178,18 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -213,6 +202,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -231,15 +222,17 @@ async def begin_reimage_all( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,22 +247,14 @@ async def begin_reimage_all( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -281,6 +266,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -295,26 +281,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -327,6 +305,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -346,15 +326,17 @@ async def begin_deallocate( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,22 +351,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +370,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -411,33 +386,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -455,8 +420,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -478,15 +446,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,28 +472,21 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -532,6 +498,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -547,28 +514,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -581,6 +539,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -602,15 +562,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -626,22 +588,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -653,8 +607,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -685,30 +641,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -722,8 +667,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -749,28 +697,18 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -784,8 +722,11 @@ async def get_instance_view( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -811,8 +752,10 @@ def list( '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_07_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -820,42 +763,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -873,6 +813,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -891,28 +832,19 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -925,6 +857,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -949,15 +883,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -973,22 +909,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1000,6 +928,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1014,26 +943,18 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1046,6 +967,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1063,15 +986,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1086,22 +1011,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1113,6 +1030,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1127,26 +1045,18 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1159,6 +1069,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1176,15 +1088,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1199,22 +1113,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1226,6 +1132,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1240,26 +1147,18 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1272,6 +1171,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1290,15 +1191,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1313,22 +1216,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1340,8 +1235,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1373,30 +1270,19 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1410,8 +1296,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1424,26 +1312,18 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1456,6 +1336,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1473,15 +1355,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1496,22 +1380,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1523,8 +1399,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -1550,26 +1428,18 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1582,6 +1452,7 @@ async def simulate_eviction( 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, @@ -1595,33 +1466,23 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RunCommandInput') + + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1637,8 +1498,11 @@ async def _run_command_initial( 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 + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -1659,15 +1523,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1680,28 +1549,21 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1713,4 +1575,5 @@ def get_long_running_output(pipeline_response): ) 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_07_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_sets_operations.py index b58757141478..e084d00f7d68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_scale_sets_operations import build_convert_to_single_placement_group_request, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_instances_request_initial, build_delete_request_initial, build_force_recovery_service_fabric_platform_update_domain_walk_request, build_get_instance_view_request, build_get_os_upgrade_history_request, build_get_request, build_list_all_request, build_list_by_location_request, build_list_request, build_list_skus_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_redeploy_request_initial, build_reimage_all_request_initial, build_reimage_request_initial, build_restart_request_initial, build_set_orchestration_service_state_request_initial, build_start_request_initial, build_update_instances_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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_07_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -168,8 +163,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -187,15 +185,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +210,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -239,6 +236,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -253,32 +251,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +280,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -311,15 +302,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,27 +327,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -363,6 +353,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -377,27 +368,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -410,6 +392,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -427,15 +411,17 @@ async def begin_delete( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -450,21 +436,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -476,8 +455,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -505,29 +486,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -541,8 +511,10 @@ async def get( 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, @@ -555,33 +527,25 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,6 +558,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -610,18 +576,22 @@ async def begin_deallocate( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,24 +603,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -662,6 +626,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -677,32 +642,23 @@ async def _delete_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -715,6 +671,8 @@ async def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace_async async def begin_delete_instances( self, resource_group_name: str, @@ -730,21 +688,25 @@ async def begin_delete_instances( :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_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -757,24 +719,18 @@ async def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -786,8 +742,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_instance_view( self, resource_group_name: str, @@ -810,27 +768,17 @@ async def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -844,8 +792,11 @@ async def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -856,8 +807,10 @@ def list( :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_07_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -865,35 +818,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -911,11 +860,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -925,8 +876,10 @@ def list_all( 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_07_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -934,34 +887,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -979,11 +927,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -998,8 +948,10 @@ def list_skus( :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_07_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -1007,36 +959,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1054,11 +1003,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, resource_group_name: str, @@ -1072,8 +1023,10 @@ def get_os_upgrade_history( :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_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1081,36 +1034,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1128,6 +1078,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1146,35 +1097,26 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1187,6 +1129,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1208,18 +1152,22 @@ async def begin_power_off( 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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1232,24 +1180,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1261,6 +1203,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1275,33 +1218,25 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1314,6 +1249,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1328,18 +1265,22 @@ async def begin_restart( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1351,24 +1292,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1380,6 +1315,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1394,33 +1330,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1433,6 +1361,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1447,18 +1377,22 @@ async def begin_start( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1470,24 +1404,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1499,6 +1427,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1513,33 +1442,25 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1552,6 +1473,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1567,18 +1490,22 @@ async def begin_redeploy( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1590,24 +1517,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1619,6 +1540,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1633,33 +1555,25 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1672,6 +1586,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -1689,18 +1605,22 @@ async def begin_perform_maintenance( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1712,24 +1632,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1741,6 +1655,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1755,30 +1670,22 @@ async def _update_instances_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1791,6 +1698,8 @@ async def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace_async async def begin_update_instances( self, resource_group_name: str, @@ -1805,18 +1714,22 @@ async def begin_update_instances( :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_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1828,24 +1741,18 @@ async def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1857,6 +1764,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1871,33 +1779,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1910,6 +1810,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1926,18 +1828,22 @@ async def begin_reimage( :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_07_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1949,24 +1855,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1978,6 +1878,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1992,33 +1893,25 @@ async def _reimage_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2031,6 +1924,8 @@ async def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace_async async def begin_reimage_all( self, resource_group_name: str, @@ -2046,18 +1941,22 @@ async def begin_reimage_all( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2069,24 +1968,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2098,8 +1991,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def force_recovery_service_fabric_platform_update_domain_walk( self, resource_group_name: str, @@ -2127,28 +2022,18 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2162,8 +2047,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace_async async def convert_to_single_placement_group( self, resource_group_name: str, @@ -2178,7 +2066,8 @@ async def convert_to_single_placement_group( :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_07_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2021_07_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 @@ -2189,30 +2078,22 @@ async def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2225,6 +2106,7 @@ async def convert_to_single_placement_group( 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, @@ -2237,30 +2119,22 @@ async def _set_orchestration_service_state_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2273,6 +2147,8 @@ async def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace_async async def begin_set_orchestration_service_state( self, resource_group_name: str, @@ -2290,15 +2166,18 @@ async def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2310,24 +2189,18 @@ async def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2339,4 +2212,5 @@ def get_long_running_output(pipeline_response): ) 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_07_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_sizes_operations.py index 736fcf587063..3ec3c27b5127 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_sizes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machine_sizes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,8 +58,10 @@ def list( :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_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -61,35 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py index 0e59be7d0715..b42ebabc9728 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_assess_patches_request_initial, build_capture_request_initial, build_convert_to_managed_disks_request_initial, build_create_or_update_request_initial, build_deallocate_request_initial, build_delete_request_initial, build_generalize_request, build_get_request, build_install_patches_request_initial, build_instance_view_request, build_list_all_request, build_list_available_sizes_request, build_list_by_location_request, build_list_request, build_perform_maintenance_request_initial, build_power_off_request_initial, build_reapply_request_initial, build_redeploy_request_initial, build_reimage_request_initial, build_restart_request_initial, build_retrieve_boot_diagnostics_data_request, build_run_command_request_initial, build_simulate_eviction_request, build_start_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,8 +59,10 @@ def list_by_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_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -62,35 +70,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,6 +112,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -125,32 +130,22 @@ async def _capture_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +161,11 @@ async def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace_async async def begin_capture( self, resource_group_name: str, @@ -186,15 +184,20 @@ async def begin_capture( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +209,21 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,6 +235,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -252,32 +250,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachine') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -295,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -315,15 +306,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -367,6 +357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +372,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -420,8 +401,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,15 +423,20 @@ async def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,27 +448,21 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -491,6 +474,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -505,27 +489,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -538,6 +513,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -551,20 +528,21 @@ async def begin_delete( :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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,21 +557,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -605,8 +576,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -635,29 +608,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -671,8 +633,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace_async async def instance_view( self, resource_group_name: str, @@ -695,27 +660,17 @@ async def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -729,8 +684,10 @@ async def instance_view( 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, @@ -742,25 +699,17 @@ async def _convert_to_managed_disks_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -773,6 +722,8 @@ async def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace_async async def begin_convert_to_managed_disks( self, resource_group_name: str, @@ -788,15 +739,17 @@ async def begin_convert_to_managed_disks( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -810,21 +763,14 @@ async def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -836,6 +782,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -850,27 +797,18 @@ async def _deallocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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] - if hibernate is not None: - query_parameters['hibernate'] = self._serialize.query("hibernate", hibernate, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + hibernate=hibernate, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -883,6 +821,8 @@ async def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace_async async def begin_deallocate( self, resource_group_name: str, @@ -901,15 +841,17 @@ async def begin_deallocate( :type hibernate: bool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -924,21 +866,14 @@ async def begin_deallocate( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -950,8 +885,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def generalize( self, resource_group_name: str, @@ -979,25 +916,17 @@ async def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1010,6 +939,8 @@ async def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1021,8 +952,10 @@ def list( :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_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1030,35 +963,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1076,11 +1005,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1093,8 +1024,10 @@ def list_all( 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_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1102,36 +1035,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1149,11 +1077,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1168,8 +1098,10 @@ def list_available_sizes( :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_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1177,36 +1109,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1224,6 +1153,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1241,27 +1171,18 @@ async def _power_off_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1274,6 +1195,8 @@ async def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace_async async def begin_power_off( self, resource_group_name: str, @@ -1294,15 +1217,17 @@ async def begin_power_off( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1317,21 +1242,14 @@ async def begin_power_off( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1343,6 +1261,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1356,27 +1275,17 @@ async def _reapply_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1389,6 +1298,8 @@ async def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace_async async def begin_reapply( self, resource_group_name: str, @@ -1403,15 +1314,17 @@ async def begin_reapply( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1425,21 +1338,14 @@ async def begin_reapply( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1451,6 +1357,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1464,25 +1371,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1495,6 +1394,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1509,15 +1410,17 @@ async def begin_restart( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1531,21 +1434,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1557,6 +1453,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1570,25 +1467,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1601,6 +1490,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -1615,15 +1506,17 @@ async def begin_start( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1637,21 +1530,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1663,6 +1549,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1676,25 +1563,17 @@ async def _redeploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1707,6 +1586,8 @@ async def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace_async async def begin_redeploy( self, resource_group_name: str, @@ -1721,15 +1602,17 @@ async def begin_redeploy( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1743,21 +1626,14 @@ async def begin_redeploy( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1769,6 +1645,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -1783,33 +1660,25 @@ async def _reimage_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1822,6 +1691,8 @@ async def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, @@ -1839,15 +1710,18 @@ async def begin_reimage( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1859,24 +1733,18 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1888,8 +1756,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def retrieve_boot_diagnostics_data( self, resource_group_name: str, @@ -1917,29 +1787,18 @@ async def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1953,8 +1812,10 @@ async def retrieve_boot_diagnostics_data( 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, @@ -1966,25 +1827,17 @@ async def _perform_maintenance_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1997,6 +1850,8 @@ async def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace_async async def begin_perform_maintenance( self, resource_group_name: str, @@ -2011,15 +1866,17 @@ async def begin_perform_maintenance( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2033,21 +1890,14 @@ async def begin_perform_maintenance( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2059,8 +1909,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def simulate_eviction( self, resource_group_name: str, @@ -2083,25 +1935,17 @@ async def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2114,6 +1958,7 @@ async def simulate_eviction( 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, @@ -2125,27 +1970,17 @@ async def _assess_patches_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2161,8 +1996,11 @@ async def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace_async async def begin_assess_patches( self, resource_group_name: str, @@ -2177,15 +2015,19 @@ async def begin_assess_patches( :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2199,24 +2041,17 @@ async def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2228,6 +2063,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2242,32 +2078,22 @@ async def _install_patches_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2283,8 +2109,11 @@ async def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace_async async def begin_install_patches( self, resource_group_name: str, @@ -2299,18 +2128,24 @@ async def begin_install_patches( :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_07_01.models.VirtualMachineInstallPatchesParameters + :type install_patches_input: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2322,27 +2157,21 @@ async def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2354,6 +2183,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -2368,32 +2198,22 @@ async def _run_command_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2409,8 +2229,11 @@ async def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace_async async def begin_run_command( self, resource_group_name: str, @@ -2428,15 +2251,20 @@ async def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2448,27 +2276,21 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2480,4 +2302,5 @@ def get_long_running_output(pipeline_response): ) 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_07_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py index 6b70bd5eb824..b70380135adb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py @@ -6,618 +6,311 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -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 ApplicationProfile - 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 CapacityReservation - from ._models_py3 import CapacityReservationGroup - from ._models_py3 import CapacityReservationGroupInstanceView - from ._models_py3 import CapacityReservationGroupListResult - from ._models_py3 import CapacityReservationGroupUpdate - from ._models_py3 import CapacityReservationInstanceView - from ._models_py3 import CapacityReservationInstanceViewWithName - from ._models_py3 import CapacityReservationListResult - from ._models_py3 import CapacityReservationProfile - from ._models_py3 import CapacityReservationUpdate - from ._models_py3 import CapacityReservationUtilization - from ._models_py3 import CommunityGallery - from ._models_py3 import CommunityGalleryImage - from ._models_py3 import CommunityGalleryImageVersion - from ._models_py3 import ComputeOperationListResult - from ._models_py3 import ComputeOperationValue - from ._models_py3 import DataDisk - from ._models_py3 import DataDiskImage - from ._models_py3 import DataDiskImageEncryption - 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 Disallowed - from ._models_py3 import DisallowedConfiguration - from ._models_py3 import DiskEncryptionSetParameters - from ._models_py3 import DiskEncryptionSettings - from ._models_py3 import DiskImageEncryption - from ._models_py3 import DiskInstanceView - from ._models_py3 import EncryptionImages - from ._models_py3 import ExtendedLocation - from ._models_py3 import Gallery - from ._models_py3 import GalleryApplication - from ._models_py3 import GalleryApplicationList - from ._models_py3 import GalleryApplicationUpdate - from ._models_py3 import GalleryApplicationVersion - from ._models_py3 import GalleryApplicationVersionList - from ._models_py3 import GalleryApplicationVersionPublishingProfile - from ._models_py3 import GalleryApplicationVersionUpdate - from ._models_py3 import GalleryArtifactPublishingProfileBase - from ._models_py3 import GalleryArtifactSource - from ._models_py3 import GalleryArtifactVersionSource - from ._models_py3 import GalleryDataDiskImage - from ._models_py3 import GalleryDiskImage - from ._models_py3 import GalleryIdentifier - from ._models_py3 import GalleryImage - from ._models_py3 import GalleryImageFeature - from ._models_py3 import GalleryImageIdentifier - from ._models_py3 import GalleryImageList - from ._models_py3 import GalleryImageUpdate - from ._models_py3 import GalleryImageVersion - from ._models_py3 import GalleryImageVersionList - from ._models_py3 import GalleryImageVersionPublishingProfile - from ._models_py3 import GalleryImageVersionStorageProfile - from ._models_py3 import GalleryImageVersionUpdate - from ._models_py3 import GalleryList - from ._models_py3 import GalleryOSDiskImage - from ._models_py3 import GalleryUpdate - 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 ImagePurchasePlan - from ._models_py3 import ImageReference - from ._models_py3 import ImageStorageProfile - from ._models_py3 import ImageUpdate - from ._models_py3 import InnerError - from ._models_py3 import InstanceViewStatus - 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 LogAnalyticsInputBase - from ._models_py3 import LogAnalyticsOperationResult - from ._models_py3 import LogAnalyticsOutput - from ._models_py3 import MaintenanceRedeployStatus - from ._models_py3 import ManagedArtifact - 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 OSDiskImageEncryption - from ._models_py3 import OSProfile - from ._models_py3 import OrchestrationServiceStateInput - from ._models_py3 import OrchestrationServiceSummary - from ._models_py3 import PatchInstallationDetail - from ._models_py3 import PatchSettings - from ._models_py3 import PirCommunityGalleryResource - from ._models_py3 import PirResource - from ._models_py3 import PirSharedGalleryResource - from ._models_py3 import Plan - from ._models_py3 import ProximityPlacementGroup - from ._models_py3 import ProximityPlacementGroupListResult - from ._models_py3 import ProximityPlacementGroupUpdate - from ._models_py3 import ProxyResource - from ._models_py3 import PublicIPAddressSku - from ._models_py3 import PurchasePlan - from ._models_py3 import RecommendedMachineConfiguration - from ._models_py3 import RecoveryWalkResponse - from ._models_py3 import RegionalReplicationStatus - from ._models_py3 import ReplicationStatus - from ._models_py3 import RequestRateByIntervalInput - from ._models_py3 import Resource - from ._models_py3 import ResourceRange - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCapacity - from ._models_py3 import ResourceSkuCosts - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkuZoneDetails - from ._models_py3 import ResourceSkusResult - from ._models_py3 import RestorePoint - from ._models_py3 import RestorePointCollection - from ._models_py3 import RestorePointCollectionListResult - from ._models_py3 import RestorePointCollectionSourceProperties - from ._models_py3 import RestorePointCollectionUpdate - from ._models_py3 import RestorePointProvisioningDetails - from ._models_py3 import RestorePointSourceMetadata - from ._models_py3 import RestorePointSourceVMDataDisk - from ._models_py3 import RestorePointSourceVMOSDisk - from ._models_py3 import RestorePointSourceVMStorageProfile - from ._models_py3 import RetrieveBootDiagnosticsDataResult - 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 SharedGallery - from ._models_py3 import SharedGalleryImage - from ._models_py3 import SharedGalleryImageList - from ._models_py3 import SharedGalleryImageVersion - from ._models_py3 import SharedGalleryImageVersionList - from ._models_py3 import SharedGalleryList - from ._models_py3 import SharingProfile - from ._models_py3 import SharingProfileGroup - from ._models_py3 import SharingUpdate - from ._models_py3 import Sku - from ._models_py3 import SoftDeletePolicy - from ._models_py3 import SpotRestorePolicy - 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 StorageProfile - from ._models_py3 import SubResource - from ._models_py3 import SubResourceReadOnly - from ._models_py3 import SubResourceWithColocationStatus - from ._models_py3 import TargetRegion - from ._models_py3 import TerminateNotificationProfile - from ._models_py3 import ThrottledRequestsInput - from ._models_py3 import UefiSettings - from ._models_py3 import UpdateResource - from ._models_py3 import UpdateResourceDefinition - 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 UserArtifactManage - from ._models_py3 import UserArtifactSource - from ._models_py3 import UserAssignedIdentitiesValue - from ._models_py3 import VMGalleryApplication - from ._models_py3 import VMScaleSetConvertToSinglePlacementGroupInput - from ._models_py3 import VMSizeProperties - 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 VirtualMachineIpTag - from ._models_py3 import VirtualMachineListResult - from ._models_py3 import VirtualMachineNetworkInterfaceConfiguration - from ._models_py3 import VirtualMachineNetworkInterfaceDnsSettingsConfiguration - from ._models_py3 import VirtualMachineNetworkInterfaceIPConfiguration - from ._models_py3 import VirtualMachinePatchStatus - from ._models_py3 import VirtualMachinePublicIPAddressConfiguration - from ._models_py3 import VirtualMachinePublicIPAddressDnsSettingsConfiguration - 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 ApplicationProfile # 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 CapacityReservation # type: ignore - from ._models import CapacityReservationGroup # type: ignore - from ._models import CapacityReservationGroupInstanceView # type: ignore - from ._models import CapacityReservationGroupListResult # type: ignore - from ._models import CapacityReservationGroupUpdate # type: ignore - from ._models import CapacityReservationInstanceView # type: ignore - from ._models import CapacityReservationInstanceViewWithName # type: ignore - from ._models import CapacityReservationListResult # type: ignore - from ._models import CapacityReservationProfile # type: ignore - from ._models import CapacityReservationUpdate # type: ignore - from ._models import CapacityReservationUtilization # type: ignore - from ._models import CommunityGallery # type: ignore - from ._models import CommunityGalleryImage # type: ignore - from ._models import CommunityGalleryImageVersion # 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 DataDiskImageEncryption # 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 Disallowed # type: ignore - from ._models import DisallowedConfiguration # type: ignore - from ._models import DiskEncryptionSetParameters # type: ignore - from ._models import DiskEncryptionSettings # type: ignore - from ._models import DiskImageEncryption # type: ignore - from ._models import DiskInstanceView # type: ignore - from ._models import EncryptionImages # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import Gallery # type: ignore - from ._models import GalleryApplication # type: ignore - from ._models import GalleryApplicationList # type: ignore - from ._models import GalleryApplicationUpdate # type: ignore - from ._models import GalleryApplicationVersion # type: ignore - from ._models import GalleryApplicationVersionList # type: ignore - from ._models import GalleryApplicationVersionPublishingProfile # type: ignore - from ._models import GalleryApplicationVersionUpdate # type: ignore - from ._models import GalleryArtifactPublishingProfileBase # type: ignore - from ._models import GalleryArtifactSource # type: ignore - from ._models import GalleryArtifactVersionSource # type: ignore - from ._models import GalleryDataDiskImage # type: ignore - from ._models import GalleryDiskImage # type: ignore - from ._models import GalleryIdentifier # type: ignore - from ._models import GalleryImage # type: ignore - from ._models import GalleryImageFeature # type: ignore - from ._models import GalleryImageIdentifier # type: ignore - from ._models import GalleryImageList # type: ignore - from ._models import GalleryImageUpdate # type: ignore - from ._models import GalleryImageVersion # type: ignore - from ._models import GalleryImageVersionList # type: ignore - from ._models import GalleryImageVersionPublishingProfile # type: ignore - from ._models import GalleryImageVersionStorageProfile # type: ignore - from ._models import GalleryImageVersionUpdate # type: ignore - from ._models import GalleryList # type: ignore - from ._models import GalleryOSDiskImage # type: ignore - from ._models import GalleryUpdate # 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 ImagePurchasePlan # 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 InstanceViewStatus # 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 LogAnalyticsInputBase # type: ignore - from ._models import LogAnalyticsOperationResult # type: ignore - from ._models import LogAnalyticsOutput # type: ignore - from ._models import MaintenanceRedeployStatus # type: ignore - from ._models import ManagedArtifact # 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 OSDiskImageEncryption # type: ignore - from ._models import OSProfile # 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 PirCommunityGalleryResource # type: ignore - from ._models import PirResource # type: ignore - from ._models import PirSharedGalleryResource # 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 ProxyResource # type: ignore - from ._models import PublicIPAddressSku # type: ignore - from ._models import PurchasePlan # type: ignore - from ._models import RecommendedMachineConfiguration # type: ignore - from ._models import RecoveryWalkResponse # type: ignore - from ._models import RegionalReplicationStatus # type: ignore - from ._models import ReplicationStatus # type: ignore - from ._models import RequestRateByIntervalInput # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRange # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCapacity # type: ignore - from ._models import ResourceSkuCosts # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceSkusResult # type: ignore - from ._models import RestorePoint # type: ignore - from ._models import RestorePointCollection # type: ignore - from ._models import RestorePointCollectionListResult # type: ignore - from ._models import RestorePointCollectionSourceProperties # type: ignore - from ._models import RestorePointCollectionUpdate # type: ignore - from ._models import RestorePointProvisioningDetails # type: ignore - from ._models import RestorePointSourceMetadata # type: ignore - from ._models import RestorePointSourceVMDataDisk # type: ignore - from ._models import RestorePointSourceVMOSDisk # type: ignore - from ._models import RestorePointSourceVMStorageProfile # type: ignore - from ._models import RetrieveBootDiagnosticsDataResult # 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 SharedGallery # type: ignore - from ._models import SharedGalleryImage # type: ignore - from ._models import SharedGalleryImageList # type: ignore - from ._models import SharedGalleryImageVersion # type: ignore - from ._models import SharedGalleryImageVersionList # type: ignore - from ._models import SharedGalleryList # type: ignore - from ._models import SharingProfile # type: ignore - from ._models import SharingProfileGroup # type: ignore - from ._models import SharingUpdate # type: ignore - from ._models import Sku # type: ignore - from ._models import SoftDeletePolicy # type: ignore - from ._models import SpotRestorePolicy # 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 StorageProfile # type: ignore - from ._models import SubResource # type: ignore - from ._models import SubResourceReadOnly # type: ignore - from ._models import SubResourceWithColocationStatus # type: ignore - from ._models import TargetRegion # type: ignore - from ._models import TerminateNotificationProfile # type: ignore - from ._models import ThrottledRequestsInput # type: ignore - from ._models import UefiSettings # type: ignore - from ._models import UpdateResource # type: ignore - from ._models import UpdateResourceDefinition # 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 UserArtifactManage # type: ignore - from ._models import UserArtifactSource # type: ignore - from ._models import UserAssignedIdentitiesValue # type: ignore - from ._models import VMGalleryApplication # type: ignore - from ._models import VMScaleSetConvertToSinglePlacementGroupInput # type: ignore - from ._models import VMSizeProperties # 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 VirtualMachineIpTag # type: ignore - from ._models import VirtualMachineListResult # type: ignore - from ._models import VirtualMachineNetworkInterfaceConfiguration # type: ignore - from ._models import VirtualMachineNetworkInterfaceDnsSettingsConfiguration # type: ignore - from ._models import VirtualMachineNetworkInterfaceIPConfiguration # type: ignore - from ._models import VirtualMachinePatchStatus # type: ignore - from ._models import VirtualMachinePublicIPAddressConfiguration # type: ignore - from ._models import VirtualMachinePublicIPAddressDnsSettingsConfiguration # 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 ._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 ApplicationProfile +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 CapacityReservation +from ._models_py3 import CapacityReservationGroup +from ._models_py3 import CapacityReservationGroupInstanceView +from ._models_py3 import CapacityReservationGroupListResult +from ._models_py3 import CapacityReservationGroupUpdate +from ._models_py3 import CapacityReservationInstanceView +from ._models_py3 import CapacityReservationInstanceViewWithName +from ._models_py3 import CapacityReservationListResult +from ._models_py3 import CapacityReservationProfile +from ._models_py3 import CapacityReservationUpdate +from ._models_py3 import CapacityReservationUtilization +from ._models_py3 import CommunityGallery +from ._models_py3 import CommunityGalleryImage +from ._models_py3 import CommunityGalleryImageVersion +from ._models_py3 import ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DataDiskImageEncryption +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 Disallowed +from ._models_py3 import DisallowedConfiguration +from ._models_py3 import DiskEncryptionSetParameters +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskImageEncryption +from ._models_py3 import DiskInstanceView +from ._models_py3 import EncryptionImages +from ._models_py3 import ExtendedLocation +from ._models_py3 import Gallery +from ._models_py3 import GalleryApplication +from ._models_py3 import GalleryApplicationList +from ._models_py3 import GalleryApplicationUpdate +from ._models_py3 import GalleryApplicationVersion +from ._models_py3 import GalleryApplicationVersionList +from ._models_py3 import GalleryApplicationVersionPublishingProfile +from ._models_py3 import GalleryApplicationVersionUpdate +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryArtifactVersionSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryIdentifier +from ._models_py3 import GalleryImage +from ._models_py3 import GalleryImageFeature +from ._models_py3 import GalleryImageIdentifier +from ._models_py3 import GalleryImageList +from ._models_py3 import GalleryImageUpdate +from ._models_py3 import GalleryImageVersion +from ._models_py3 import GalleryImageVersionList +from ._models_py3 import GalleryImageVersionPublishingProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryImageVersionUpdate +from ._models_py3 import GalleryList +from ._models_py3 import GalleryOSDiskImage +from ._models_py3 import GalleryUpdate +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 ImagePurchasePlan +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import ImageUpdate +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +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 LogAnalyticsInputBase +from ._models_py3 import LogAnalyticsOperationResult +from ._models_py3 import LogAnalyticsOutput +from ._models_py3 import MaintenanceRedeployStatus +from ._models_py3 import ManagedArtifact +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 OSDiskImageEncryption +from ._models_py3 import OSProfile +from ._models_py3 import OrchestrationServiceStateInput +from ._models_py3 import OrchestrationServiceSummary +from ._models_py3 import PatchInstallationDetail +from ._models_py3 import PatchSettings +from ._models_py3 import PirCommunityGalleryResource +from ._models_py3 import PirResource +from ._models_py3 import PirSharedGalleryResource +from ._models_py3 import Plan +from ._models_py3 import ProximityPlacementGroup +from ._models_py3 import ProximityPlacementGroupListResult +from ._models_py3 import ProximityPlacementGroupUpdate +from ._models_py3 import ProxyResource +from ._models_py3 import PublicIPAddressSku +from ._models_py3 import PurchasePlan +from ._models_py3 import RecommendedMachineConfiguration +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RegionalReplicationStatus +from ._models_py3 import ReplicationStatus +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceRange +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCapacity +from ._models_py3 import ResourceSkuCosts +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceSkusResult +from ._models_py3 import RestorePoint +from ._models_py3 import RestorePointCollection +from ._models_py3 import RestorePointCollectionListResult +from ._models_py3 import RestorePointCollectionSourceProperties +from ._models_py3 import RestorePointCollectionUpdate +from ._models_py3 import RestorePointSourceMetadata +from ._models_py3 import RestorePointSourceVMDataDisk +from ._models_py3 import RestorePointSourceVMOSDisk +from ._models_py3 import RestorePointSourceVMStorageProfile +from ._models_py3 import RetrieveBootDiagnosticsDataResult +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 SharedGallery +from ._models_py3 import SharedGalleryImage +from ._models_py3 import SharedGalleryImageList +from ._models_py3 import SharedGalleryImageVersion +from ._models_py3 import SharedGalleryImageVersionList +from ._models_py3 import SharedGalleryList +from ._models_py3 import SharingProfile +from ._models_py3 import SharingProfileGroup +from ._models_py3 import SharingUpdate +from ._models_py3 import Sku +from ._models_py3 import SoftDeletePolicy +from ._models_py3 import SpotRestorePolicy +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 StorageProfile +from ._models_py3 import SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import SubResourceWithColocationStatus +from ._models_py3 import TargetRegion +from ._models_py3 import TerminateNotificationProfile +from ._models_py3 import ThrottledRequestsInput +from ._models_py3 import UefiSettings +from ._models_py3 import UpdateResource +from ._models_py3 import UpdateResourceDefinition +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 UserArtifactManage +from ._models_py3 import UserArtifactSource +from ._models_py3 import UserAssignedIdentitiesValue +from ._models_py3 import VMGalleryApplication +from ._models_py3 import VMScaleSetConvertToSinglePlacementGroupInput +from ._models_py3 import VMSizeProperties +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 VirtualMachineIpTag +from ._models_py3 import VirtualMachineListResult +from ._models_py3 import VirtualMachineNetworkInterfaceConfiguration +from ._models_py3 import VirtualMachineNetworkInterfaceDnsSettingsConfiguration +from ._models_py3 import VirtualMachineNetworkInterfaceIPConfiguration +from ._models_py3 import VirtualMachinePatchStatus +from ._models_py3 import VirtualMachinePublicIPAddressConfiguration +from ._models_py3 import VirtualMachinePublicIPAddressDnsSettingsConfiguration +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 + from ._compute_management_client_enums import ( AggregatedReplicationState, @@ -857,7 +550,6 @@ 'RestorePointCollectionListResult', 'RestorePointCollectionSourceProperties', 'RestorePointCollectionUpdate', - 'RestorePointProvisioningDetails', 'RestorePointSourceMetadata', 'RestorePointSourceVMDataDisk', 'RestorePointSourceVMOSDisk', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py index 9f2bcaf8ea39..474ca22c62b5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the aggregated replication status based on all the regional replication status flags. """ @@ -35,7 +20,7 @@ class AggregatedReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, E COMPLETED = "Completed" FAILED = "Failed" -class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. """ @@ -43,7 +28,7 @@ class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CLASSIC = "Classic" ALIGNED = "Aligned" -class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -54,15 +39,15 @@ class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class CapacityReservationGroupInstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CapacityReservationGroupInstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTANCE_VIEW = "instanceView" -class CapacityReservationInstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CapacityReservationInstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTANCE_VIEW = "instanceView" -class ConsistencyModeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConsistencyModeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the consistency mode for the restore point. Please refer to https://aka.ms/RestorePoints for more details. """ @@ -71,7 +56,7 @@ class ConsistencyModeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_SYSTEM_CONSISTENT = "FileSystemConsistent" APPLICATION_CONSISTENT = "ApplicationConsistent" -class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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:`
    ` @@ -82,20 +67,20 @@ class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" -class DeleteOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify what happens to the network interface when the VM is deleted """ DELETE = "Delete" DETACH = "Detach" -class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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 @@ -108,7 +93,7 @@ class DiffDiskPlacement(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CACHE_DISK = "CacheDisk" RESOURCE_DISK = "ResourceDisk" -class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -121,7 +106,7 @@ class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EMPTY = "Empty" ATTACH = "Attach" -class DiskDeleteOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskDeleteOptionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the behavior of the managed disk when the VM gets deleted i.e whether the managed disk is deleted or detached. Supported values::code:`
    `:code:`
    ` **Delete** If this value is used, the managed disk is deleted when VM gets deleted.:code:`
    `:code:`
    ` **Detach** @@ -132,7 +117,7 @@ class DiskDeleteOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DETACH = "Detach" -class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -146,7 +131,7 @@ class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) FORCE_DETACH = "ForceDetach" -class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExecutionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Script execution status. """ @@ -158,28 +143,28 @@ class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TIMED_OUT = "TimedOut" CANCELED = "Canceled" -class ExpandTypesForGetCapacityReservationGroups(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpandTypesForGetCapacityReservationGroups(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_MACHINE_SCALE_SET_VMS_REF = "virtualMachineScaleSetVMs/$ref" VIRTUAL_MACHINES_REF = "virtualMachines/$ref" -class ExpandTypesForGetVMScaleSets(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpandTypesForGetVMScaleSets(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_DATA = "userData" -class ExtendedLocationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the extended location. """ EDGE_ZONE = "EdgeZone" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -190,7 +175,7 @@ class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(_CaseI DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImagePropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -201,7 +186,7 @@ class GalleryImagePropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryImageVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -212,7 +197,7 @@ class GalleryImageVersionPropertiesProvisioningState(with_metaclass(_CaseInsensi DELETING = "Deleting" MIGRATING = "Migrating" -class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GalleryPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -223,7 +208,7 @@ class GalleryPropertiesProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta DELETING = "Deleting" MIGRATING = "Migrating" -class GallerySharingPermissionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GallerySharingPermissionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property allows you to specify the permission of sharing gallery. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** :code:`
    `:code:`
    ` **Groups** """ @@ -231,7 +216,7 @@ class GallerySharingPermissionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str PRIVATE = "Private" GROUPS = "Groups" -class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' """ @@ -239,33 +224,33 @@ class HostCaching(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class HyperVGeneration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. """ V1 = "V1" V2 = "V2" -class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the HyperVGeneration Type """ V1 = "V1" V2 = "V2" -class InstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTANCE_VIEW = "instanceView" USER_DATA = "userData" -class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Interval value in minutes used to create LogAnalytics call rate logs. """ @@ -274,7 +259,7 @@ class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): THIRTY_MINS = "ThirtyMins" SIXTY_MINS = "SixtyMins" -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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'. @@ -283,7 +268,7 @@ class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class IPVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IPVersions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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'. @@ -292,7 +277,7 @@ class IPVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): I_PV4 = "IPv4" I_PV6 = "IPv6" -class LinuxPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinuxPatchAssessmentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` @@ -303,7 +288,7 @@ class LinuxPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinuxVMGuestPatchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - The virtual machine's @@ -315,7 +300,7 @@ class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Last Maintenance Operation Result Code. """ @@ -324,14 +309,14 @@ class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMet MAINTENANCE_ABORTED = "MaintenanceAborted" MAINTENANCE_COMPLETED = "MaintenanceCompleted" -class NetworkApiVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkApiVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations """ TWO_THOUSAND_TWENTY11_01 = "2020-11-01" -class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS State. """ @@ -340,35 +325,35 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Specialized image. Contains already provisioned OS Disk. SPECIALIZED = "Specialized" -class OperatingSystemType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the Operating System type. """ WINDOWS = "Windows" LINUX = "Linux" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system of the osDiskImage. """ WINDOWS = "Windows" LINUX = "Linux" -class OrchestrationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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)): +class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. """ @@ -376,21 +361,21 @@ class OrchestrationServiceState(with_metaclass(_CaseInsensitiveEnumMeta, str, En RUNNING = "Running" SUSPENDED = "Suspended" -class OrchestrationServiceStateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrchestrationServiceStateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action to be performed. """ RESUME = "Resume" SUSPEND = "Suspend" -class PatchAssessmentState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class PatchInstallationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the patch after the installation operation completed. """ @@ -401,7 +386,7 @@ class PatchInstallationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) NOT_SELECTED = "NotSelected" PENDING = "Pending" -class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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." @@ -413,7 +398,7 @@ class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" -class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https** """ @@ -421,7 +406,7 @@ class ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -430,28 +415,28 @@ class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, STANDARD = "Standard" ULTRA = "Ultra" -class PublicIPAddressSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAddressSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify public IP sku name """ BASIC = "Basic" STANDARD = "Standard" -class PublicIPAddressSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAddressSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify public IP sku tier """ REGIONAL = "Regional" GLOBAL_ENUM = "Global" -class PublicIPAllocationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicIPAllocationMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify the public IP allocation type """ DYNAMIC = "Dynamic" STATIC = "Static" -class ReplicationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Optional parameter which specifies the mode to be used for replication. This property is not updatable. """ @@ -459,7 +444,7 @@ class ReplicationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FULL = "Full" SHALLOW = "Shallow" -class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is the regional replication state. """ @@ -468,11 +453,11 @@ class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAILED = "Failed" -class ReplicationStatusTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationStatusTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REPLICATION_STATUS = "ReplicationStatus" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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. @@ -483,7 +468,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuCapacityScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scale type applicable to the sku. """ @@ -491,32 +476,32 @@ class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, MANUAL = "Manual" NONE = "None" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for restriction. """ QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of restrictions. """ LOCATION = "Location" ZONE = "Zone" -class RestorePointCollectionExpandOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestorePointCollectionExpandOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RESTORE_POINTS = "restorePoints" -class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -525,7 +510,7 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. @@ -533,11 +518,11 @@ class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TRUSTED_LAUNCH = "TrustedLaunch" -class SelectPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SelectPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PERMISSIONS = "Permissions" -class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. """ @@ -545,11 +530,11 @@ class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_LOGON = "AutoLogon" FIRST_LOGON_COMMANDS = "FirstLogonCommands" -class SharedToValues(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharedToValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TENANT = "tenant" -class SharingProfileGroupTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharingProfileGroupTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property allows you to specify the type of sharing group. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** :code:`
    `:code:`
    ` **AADTenants** @@ -558,7 +543,7 @@ class SharingProfileGroupTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu SUBSCRIPTIONS = "Subscriptions" AAD_TENANTS = "AADTenants" -class SharingUpdateOperationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharingUpdateOperationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property allows you to specify the operation type of gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset** @@ -568,7 +553,7 @@ class SharingUpdateOperationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, REMOVE = "Remove" RESET = "Reset" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -576,7 +561,7 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" ERROR = "Error" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the storage account type to be used to store the image. This property is not updatable. """ @@ -585,7 +570,7 @@ class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -603,7 +588,7 @@ class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PREMIUM_ZRS = "Premium_ZRS" STANDARD_SSD_ZRS = "StandardSSD_ZRS" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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 @@ -615,7 +600,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" ROLLING = "Rolling" -class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invoker of the Upgrade Operation """ @@ -623,7 +608,7 @@ class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum USER = "User" PLATFORM = "Platform" -class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Code indicating the current status of the upgrade. """ @@ -632,14 +617,14 @@ class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED = "Completed" FAULTED = "Faulted" -class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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. @@ -649,20 +634,20 @@ class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, LOW = "Low" SPOT = "Spot" -class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" OLDEST_VM = "OldestVM" NEWEST_VM = "NewestVM" -class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +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: @@ -844,20 +829,20 @@ class VirtualMachineSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum STANDARD_NV12 = "Standard_NV12" STANDARD_NV24 = "Standard_NV24" -class VmDiskTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VmDiskTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """VM disk types which are disallowed. """ NONE = "None" UNMANAGED = "Unmanaged" -class VMGuestPatchClassificationLinux(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationLinux(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" OTHER = "Other" -class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchClassificationWindows(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CRITICAL = "Critical" SECURITY = "Security" @@ -868,7 +853,7 @@ class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, TOOLS = "Tools" UPDATES = "Updates" -class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the reboot requirements of the patch. """ @@ -877,7 +862,7 @@ class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, E ALWAYS_REQUIRES_REBOOT = "AlwaysRequiresReboot" CAN_REQUEST_REBOOT = "CanRequestReboot" -class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines when it is acceptable to reboot a VM during a software update operation. """ @@ -885,7 +870,7 @@ class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, En NEVER = "Never" ALWAYS = "Always" -class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGuestPatchRebootStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reboot state of the VM following completion of the operation. """ @@ -896,7 +881,7 @@ class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu FAILED = "Failed" COMPLETED = "Completed" -class WindowsPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WindowsPatchAssessmentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` @@ -907,7 +892,7 @@ class WindowsPatchAssessmentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, E IMAGE_DEFAULT = "ImageDefault" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" -class WindowsVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WindowsVMGuestPatchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Manual** - You control the application of diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models.py deleted file mode 100644 index 67b8d6119e4f..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models.py +++ /dev/null @@ -1,13073 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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 - :param hibernation_enabled: The flag that enables or disables hibernation capability on the VM. - :type hibernation_enabled: bool - """ - - _attribute_map = { - 'ultra_ssd_enabled': {'key': 'ultraSSDEnabled', 'type': 'bool'}, - 'hibernation_enabled': {'key': 'hibernationEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalCapabilities, self).__init__(**kwargs) - self.ultra_ssd_enabled = kwargs.get('ultra_ssd_enabled', None) - self.hibernation_enabled = kwargs.get('hibernation_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. - - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only - acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is - Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and - "Microsoft-Windows-Shell-Setup". The default value is None. - :type 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_07_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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(AdditionalUnattendContent, self).__init__(**kwargs) - self.pass_name = kwargs.get('pass_name', None) - self.component_name = kwargs.get('component_name', None) - 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. - - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, - 'innererror': {'key': 'innererror', 'type': 'InnerError'}, - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiError, self).__init__(**kwargs) - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApiErrorBase(msrest.serialization.Model): - """Api error base. - - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiErrorBase, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ApplicationProfile(msrest.serialization.Model): - """Contains the list of gallery applications that should be made available to the VM/VMSS. - - :param gallery_applications: Specifies the gallery applications that should be made available - to the VM/VMSS. - :type gallery_applications: list[~azure.mgmt.compute.v2021_07_01.models.VMGalleryApplication] - """ - - _attribute_map = { - 'gallery_applications': {'key': 'galleryApplications', 'type': '[VMGalleryApplication]'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationProfile, self).__init__(**kwargs) - self.gallery_applications = kwargs.get('gallery_applications', None) - - -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. - - 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] - """ - - _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}'}, - } - - def __init__( - self, - **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) - - -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 `Availability sets overview `_. :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance and updates 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. - - 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_07_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_07_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_07_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'statuses': {'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_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(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 AvailabilitySetListResult(msrest.serialization.Model): - """The List Availability Set operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2021_07_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 = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilitySetListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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 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_07_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_07_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_07_01.models.SubResource - :ivar statuses: The resource status information. - :vartype statuses: list[~azure.mgmt.compute.v2021_07_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, - **kwargs - ): - 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 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_07_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_07_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, - **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_07_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 CapacityReservation(Resource): - """Specifies information about the capacity reservation. - - 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 resource for which capacity needs be reserved. The SKU name - and capacity is required to be set. Currently VM Skus with the capability called - 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs - in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported - values. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.Sku - :param zones: Availability Zone to use for this capacity reservation. The zone has to be single - value and also should be part for the list of zones specified during the capacity reservation - group creation. The zone can be assigned only during creation. If not provided, the reservation - supports only non-zonal deployments. If provided, enforces VM/VMSS using this capacity - reservation to be in same zone. - :type zones: list[str] - :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the - platform which does not change throughout the lifetime of the resource. - :vartype reservation_id: str - :ivar virtual_machines_associated: A list of all virtual machine resource ids that are - associated with the capacity reservation. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_07_01.models.SubResourceReadOnly] - :ivar provisioning_time: The date time when the capacity reservation was last updated. - :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 Capacity reservation instance view. - :vartype instance_view: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationInstanceView - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'reservation_id': {'readonly': True}, - 'virtual_machines_associated': {'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'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'reservation_id': {'key': 'properties.reservationId', 'type': 'str'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservation, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.zones = kwargs.get('zones', None) - self.reservation_id = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - - -class CapacityReservationGroup(Resource): - """Specifies information about the capacity reservation group that the capacity reservations should be assigned to. :code:`
    `:code:`
    ` Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation cannot be added or moved to another capacity reservation 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 Zones to use for this capacity reservation group. The zones can be - assigned only during creation. If not provided, the group supports only regional resources in - the region. If provided, enforces each capacity reservation in the group to be in one of the - zones. - :type zones: list[str] - :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to - capacity reservation group. - :vartype capacity_reservations: - list[~azure.mgmt.compute.v2021_07_01.models.SubResourceReadOnly] - :ivar virtual_machines_associated: A list of references to all virtual machines associated to - the capacity reservation group. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_07_01.models.SubResourceReadOnly] - :ivar instance_view: The capacity reservation group instance view which has the list of - instance views for all the capacity reservations that belong to the capacity reservation group. - :vartype instance_view: - ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupInstanceView - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'capacity_reservations': {'readonly': True}, - 'virtual_machines_associated': {'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]'}, - 'capacity_reservations': {'key': 'properties.capacityReservations', 'type': '[SubResourceReadOnly]'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationGroupInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroup, self).__init__(**kwargs) - self.zones = kwargs.get('zones', None) - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None - - -class CapacityReservationGroupInstanceView(msrest.serialization.Model): - """CapacityReservationGroupInstanceView. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar capacity_reservations: List of instance view of the capacity reservations under the - capacity reservation group. - :vartype capacity_reservations: - list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationInstanceViewWithName] - """ - - _validation = { - 'capacity_reservations': {'readonly': True}, - } - - _attribute_map = { - 'capacity_reservations': {'key': 'capacityReservations', 'type': '[CapacityReservationInstanceViewWithName]'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroupInstanceView, self).__init__(**kwargs) - self.capacity_reservations = None - - -class CapacityReservationGroupListResult(msrest.serialization.Model): - """The List capacity reservation group with resource group response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of capacity reservation groups. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroup] - :param next_link: The URI to fetch the next page of capacity reservation groups. Call - ListNext() with this URI to fetch the next page of capacity reservation groups. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CapacityReservationGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class CapacityReservationGroupUpdate(UpdateResource): - """Specifies information about the capacity reservation group. Only tags can 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] - :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to - capacity reservation group. - :vartype capacity_reservations: - list[~azure.mgmt.compute.v2021_07_01.models.SubResourceReadOnly] - :ivar virtual_machines_associated: A list of references to all virtual machines associated to - the capacity reservation group. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_07_01.models.SubResourceReadOnly] - :ivar instance_view: The capacity reservation group instance view which has the list of - instance views for all the capacity reservations that belong to the capacity reservation group. - :vartype instance_view: - ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupInstanceView - """ - - _validation = { - 'capacity_reservations': {'readonly': True}, - 'virtual_machines_associated': {'readonly': True}, - 'instance_view': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'capacity_reservations': {'key': 'properties.capacityReservations', 'type': '[SubResourceReadOnly]'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationGroupInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationGroupUpdate, self).__init__(**kwargs) - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None - - -class CapacityReservationInstanceView(msrest.serialization.Model): - """The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] - """ - - _attribute_map = { - 'utilization_info': {'key': 'utilizationInfo', 'type': 'CapacityReservationUtilization'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationInstanceView, self).__init__(**kwargs) - self.utilization_info = kwargs.get('utilization_info', None) - self.statuses = kwargs.get('statuses', None) - - -class CapacityReservationInstanceViewWithName(CapacityReservationInstanceView): - """The instance view of a capacity reservation that includes the name of the capacity reservation. It is used for the response to the instance view of a capacity reservation group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] - :ivar name: The name of the capacity reservation. - :vartype name: str - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'utilization_info': {'key': 'utilizationInfo', 'type': 'CapacityReservationUtilization'}, - 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationInstanceViewWithName, self).__init__(**kwargs) - self.name = None - - -class CapacityReservationListResult(msrest.serialization.Model): - """The list capacity reservation operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of capacity reservations. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] - :param next_link: The URI to fetch the next page of capacity reservations. Call ListNext() with - this URI to fetch the next page of capacity reservations. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CapacityReservation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class CapacityReservationProfile(msrest.serialization.Model): - """The parameters of a capacity reservation Profile. - - :param capacity_reservation_group: Specifies the capacity reservation group resource id that - should be used for allocating the virtual machine or scaleset vm instances provided enough - capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more - details. - :type capacity_reservation_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource - """ - - _attribute_map = { - 'capacity_reservation_group': {'key': 'capacityReservationGroup', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationProfile, self).__init__(**kwargs) - self.capacity_reservation_group = kwargs.get('capacity_reservation_group', None) - - -class CapacityReservationUpdate(UpdateResource): - """Specifies information about the capacity reservation. Only tags and sku.capacity can 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 sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity - is required to be set. Currently VM Skus with the capability called - 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs - in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported - values. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.Sku - :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the - platform which does not change throughout the lifetime of the resource. - :vartype reservation_id: str - :ivar virtual_machines_associated: A list of all virtual machine resource ids that are - associated with the capacity reservation. - :vartype virtual_machines_associated: - list[~azure.mgmt.compute.v2021_07_01.models.SubResourceReadOnly] - :ivar provisioning_time: The date time when the capacity reservation was last updated. - :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 Capacity reservation instance view. - :vartype instance_view: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationInstanceView - """ - - _validation = { - 'reservation_id': {'readonly': True}, - 'virtual_machines_associated': {'readonly': True}, - 'provisioning_time': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'reservation_id': {'key': 'properties.reservationId', 'type': 'str'}, - 'virtual_machines_associated': {'key': 'properties.virtualMachinesAssociated', 'type': '[SubResourceReadOnly]'}, - 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'CapacityReservationInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationUpdate, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.reservation_id = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - - -class CapacityReservationUtilization(msrest.serialization.Model): - """Represents the capacity reservation utilization in terms of resources allocated. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar virtual_machines_allocated: A list of all virtual machines resource ids allocated against - the capacity reservation. - :vartype virtual_machines_allocated: - list[~azure.mgmt.compute.v2021_07_01.models.SubResourceReadOnly] - """ - - _validation = { - 'virtual_machines_allocated': {'readonly': True}, - } - - _attribute_map = { - 'virtual_machines_allocated': {'key': 'virtualMachinesAllocated', 'type': '[SubResourceReadOnly]'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityReservationUtilization, self).__init__(**kwargs) - self.virtual_machines_allocated = None - - -class PirCommunityGalleryResource(msrest.serialization.Model): - """Base information about the community gallery resource in pir. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PirCommunityGalleryResource, self).__init__(**kwargs) - self.name = None - self.location = None - self.type = None - self.unique_id = kwargs.get('unique_id', None) - - -class CommunityGallery(PirCommunityGalleryResource): - """Specifies information about the Community Gallery that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGallery, self).__init__(**kwargs) - - -class CommunityGalleryImage(PirCommunityGalleryResource): - """Specifies information about the gallery image definition that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryImage, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.features = kwargs.get('features', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - - -class CommunityGalleryImageVersion(PirCommunityGalleryResource): - """Specifies information about the gallery image version that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :ivar type: Resource type. - :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str - :param published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - 'published_date': {'key': 'properties.publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryImageVersion, self).__init__(**kwargs) - self.published_date = kwargs.get('published_date', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - - -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_07_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_07_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_07_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_07_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_07_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_07_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_07_01.models.DiskDetachOptionTypes - :param delete_option: Specifies whether data disk should be deleted or detached upon VM - deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this - value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** - If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` - The default value is set to **detach**. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes - """ - - _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'}, - 'delete_option': {'key': 'deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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) - self.delete_option = kwargs.get('delete_option', None) - - -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 DiskImageEncryption(msrest.serialization.Model): - """This is the disk image encryption base class. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskImageEncryption, self).__init__(**kwargs) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class DataDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for a data disk image. - - All required parameters must be populated in order to send to Azure. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - :param lun: Required. This property specifies the logical unit number of the data disk. This - value is used to identify data disks within the Virtual Machine and therefore must be unique - for each data disk attached to the Virtual Machine. - :type lun: int - """ - - _validation = { - 'lun': {'required': True}, - } - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDiskImageEncryption, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -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_07_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_07_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_07_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_07_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, - **kwargs - ): - 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 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, - **kwargs - ): - super(DedicatedHostAllocatableVM, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.count = kwargs.get('count', None) - - -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_07_01.models.DedicatedHostAllocatableVM] - """ - - _attribute_map = { - 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, - } - - def __init__( - self, - **kwargs - ): - super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) - self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) - - -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_07_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_07_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, - **kwargs - ): - 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 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_07_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. The list of dedicated host groups. - :type value: list[~azure.mgmt.compute.v2021_07_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, - **kwargs - ): - super(DedicatedHostGroupListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -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_07_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_07_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, - **kwargs - ): - 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 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_07_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_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, - **kwargs - ): - super(DedicatedHostInstanceView, self).__init__(**kwargs) - self.asset_id = None - self.available_capacity = kwargs.get('available_capacity', None) - self.statuses = kwargs.get('statuses', None) - - -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_07_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_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, - **kwargs - ): - 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_07_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_07_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_07_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_07_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_07_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_07_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/azure/virtual-machines/windows/sizes and Linux VM at - https://docs.microsoft.com/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_07_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 Disallowed(msrest.serialization.Model): - """Describes the disallowed disk types. - - :param disk_types: A list of disk types. - :type disk_types: list[str] - """ - - _attribute_map = { - 'disk_types': {'key': 'diskTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Disallowed, self).__init__(**kwargs) - self.disk_types = kwargs.get('disk_types', 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_07_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_07_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_07_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_07_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_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 EncryptionImages(msrest.serialization.Model): - """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. - - :param os_disk_image: Contains encryption settings for an OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImageEncryption - :param data_disk_images: A list of encryption specifications for data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.DataDiskImageEncryption] - """ - - _attribute_map = { - 'os_disk_image': {'key': 'osDiskImage', 'type': 'OSDiskImageEncryption'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[DataDiskImageEncryption]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionImages, self).__init__(**kwargs) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', 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_07_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 Gallery(Resource): - """Specifies information about the Shared Image Gallery that you want to create or update. - - 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 description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile - :param soft_delete_policy: Contains information about the soft deletion policy of the gallery. - :type soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'sharing_profile': {'key': 'properties.sharingProfile', 'type': 'SharingProfile'}, - 'soft_delete_policy': {'key': 'properties.softDeletePolicy', 'type': 'SoftDeletePolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(Gallery, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - self.sharing_profile = kwargs.get('sharing_profile', None) - self.soft_delete_policy = kwargs.get('soft_delete_policy', None) - - -class GalleryApplication(Resource): - """Specifies information about the gallery Application Definition that you want to create or update. - - 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 description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplication, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationList(msrest.serialization.Model): - """The List Gallery Applications operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application - Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class UpdateResourceDefinition(msrest.serialization.Model): - """The Update Resource model definition. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateResourceDefinition, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - - -class GalleryApplicationUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Definition that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This - property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that - application is built for. :code:`
    `:code:`
    ` Possible values are: - :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values - include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.supported_os_type = kwargs.get('supported_os_type', None) - - -class GalleryApplicationVersion(Resource): - """Specifies information about the gallery Application Version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryApplicationVersionList(msrest.serialization.Model): - """The List Gallery Application version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call - ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryApplicationVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): - """Describes the basic gallery artifact publishing profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Possible values include: "Full", "Shallow". - :type replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'replication_mode': {'key': 'replicationMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) - self.target_regions = kwargs.get('target_regions', None) - self.replica_count = kwargs.get('replica_count', None) - self.exclude_from_latest = kwargs.get('exclude_from_latest', None) - self.published_date = None - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - self.replication_mode = kwargs.get('replication_mode', None) - - -class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image version. - - 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 target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Possible values include: "Full", "Shallow". - :type replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool - """ - - _validation = { - 'published_date': {'readonly': True}, - 'source': {'required': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'replication_mode': {'key': 'replicationMode', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, - 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) - self.source = kwargs['source'] - self.manage_actions = kwargs.get('manage_actions', None) - self.enable_health_check = kwargs.get('enable_health_check', None) - - -class GalleryApplicationVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery Application Version that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: - ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPropertiesProvisioningState - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryApplicationVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.replication_status = None - - -class GalleryArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2021_07_01.models.ManagedArtifact - """ - - _validation = { - 'managed_image': {'required': True}, - } - - _attribute_map = { - 'managed_image': {'key': 'managedImage', 'type': 'ManagedArtifact'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactSource, self).__init__(**kwargs) - self.managed_image = kwargs['managed_image'] - - -class GalleryArtifactVersionSource(msrest.serialization.Model): - """The gallery artifact version source. - - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, - user image or storage account resource. - :type id: str - :param uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob - source. - :type uri: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryArtifactVersionSource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.uri = kwargs.get('uri', None) - - -class GalleryDiskImage(msrest.serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDiskImage, self).__init__(**kwargs) - self.size_in_gb = None - self.host_caching = kwargs.get('host_caching', None) - self.source = kwargs.get('source', None) - - -class GalleryDataDiskImage(GalleryDiskImage): - """This is the data disk 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 size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This - value is used to identify data disks within the Virtual Machine and therefore must be unique - for each data disk attached to the Virtual Machine. - :type lun: int - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - 'lun': {'required': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryDataDiskImage, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -class GalleryIdentifier(msrest.serialization.Model): - """Describes the gallery unique name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated - automatically by Azure. - :vartype unique_name: str - """ - - _validation = { - 'unique_name': {'readonly': True}, - } - - _attribute_map = { - 'unique_name': {'key': 'uniqueName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryIdentifier, self).__init__(**kwargs) - self.unique_name = None - - -class GalleryImage(Resource): - """Specifies information about the gallery image definition that you want to create or update. - - 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 description: The description of this gallery image definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryImagePropertiesProvisioningState - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] - """ - - _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}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImage, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - self.features = kwargs.get('features', None) - - -class GalleryImageFeature(msrest.serialization.Model): - """A feature for gallery image. - - :param name: The name of the gallery image feature. - :type name: str - :param value: The value of the gallery image feature. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageFeature, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class GalleryImageIdentifier(msrest.serialization.Model): - """This is the gallery image definition identifier. - - All required parameters must be populated in order to send to Azure. - - :param publisher: Required. The name of the gallery image definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery image definition offer. - :type offer: str - :param sku: Required. The name of the gallery image definition SKU. - :type sku: str - """ - - _validation = { - 'publisher': {'required': True}, - 'offer': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageIdentifier, self).__init__(**kwargs) - self.publisher = kwargs['publisher'] - self.offer = kwargs['offer'] - self.sku = kwargs['sku'] - - -class GalleryImageList(msrest.serialization.Model): - """The List Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image - Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageUpdate(UpdateResourceDefinition): - """Specifies information about the gallery image definition that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery image definition resource. This property is - updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryImagePropertiesProvisioningState - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'eula': {'key': 'properties.eula', 'type': 'str'}, - 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, - 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.eula = kwargs.get('eula', None) - self.privacy_statement_uri = kwargs.get('privacy_statement_uri', None) - self.release_note_uri = kwargs.get('release_note_uri', None) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - self.provisioning_state = None - self.features = kwargs.get('features', None) - - -class GalleryImageVersion(Resource): - """Specifies information about the gallery image version that you want to create or update. - - 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 publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'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}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersion, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryImageVersionList(msrest.serialization.Model): - """The List Gallery Image version operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of gallery image versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery image versions. Call ListNext() - with this to fetch the next page of gallery image versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery image Version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param target_regions: The target regions where the Image Version is going to be replicated to. - This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This - property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool - :ivar published_date: The timestamp for when the gallery image version is published. - :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Possible values include: "Full", "Shallow". - :type replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode - """ - - _validation = { - 'published_date': {'readonly': True}, - } - - _attribute_map = { - 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, - 'replica_count': {'key': 'replicaCount', 'type': 'int'}, - 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, - 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'replication_mode': {'key': 'replicationMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionPublishingProfile, self).__init__(**kwargs) - - -class GalleryImageVersionStorageProfile(msrest.serialization.Model): - """This is the storage profile of a Gallery Image Version. - - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.GalleryDataDiskImage] - """ - - _attribute_map = { - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - 'os_disk_image': {'key': 'osDiskImage', 'type': 'GalleryOSDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[GalleryDataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', None) - - -class GalleryImageVersionUpdate(UpdateResourceDefinition): - """Specifies information about the gallery image version that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: - ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPublishingProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile - :ivar replication_status: This is the replication status of the gallery image version. - :vartype replication_status: ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'replication_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, - 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageVersionUpdate, self).__init__(**kwargs) - self.publishing_profile = kwargs.get('publishing_profile', None) - self.provisioning_state = None - self.storage_profile = kwargs.get('storage_profile', None) - self.replication_status = None - - -class GalleryList(msrest.serialization.Model): - """The List Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to - fetch the next page of galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Gallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: This property indicates the size of the VHD to be created. - :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and - 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryOSDiskImage, self).__init__(**kwargs) - - -class GalleryUpdate(UpdateResourceDefinition): - """Specifies information about the Shared Image Gallery that you want to update. - - 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 - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this Shared Image Gallery resource. This property is - updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.compute.v2021_07_01.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile - :param soft_delete_policy: Contains information about the soft deletion policy of the gallery. - :type soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'sharing_profile': {'key': 'properties.sharingProfile', 'type': 'SharingProfile'}, - 'soft_delete_policy': {'key': 'properties.softDeletePolicy', 'type': 'SoftDeletePolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryUpdate, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.identifier = kwargs.get('identifier', None) - self.provisioning_state = None - self.sharing_profile = kwargs.get('sharing_profile', None) - self.soft_delete_policy = kwargs.get('soft_delete_policy', 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_07_01.models.VirtualMachineSizeTypes - :param vm_size_properties: Specifies the properties for customizing the size of the virtual - machine. Minimum api-version: 2021-07-01. :code:`
    `:code:`
    ` This feature is still in - preview mode and is not supported for VirtualMachineScaleSet. :code:`
    `:code:`
    ` Please - follow the instructions in `VM Customization `_ for more - details. - :type vm_size_properties: ~azure.mgmt.compute.v2021_07_01.models.VMSizeProperties - """ - - _attribute_map = { - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'vm_size_properties': {'key': 'vmSizeProperties', 'type': 'VMSizeProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(HardwareProfile, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - self.vm_size_properties = kwargs.get('vm_size_properties', 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_07_01.models.ExtendedLocation - :param source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_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_07_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_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_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 ImagePurchasePlan(msrest.serialization.Model): - """Describes the gallery image definition purchase plan. This is used by marketplace images. - - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImagePurchasePlan, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.publisher = kwargs.get('publisher', None) - self.product = kwargs.get('product', None) - - -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 - :param shared_gallery_image_id: Specified the shared gallery image unique id for vm deployment. - This can be fetched from shared gallery image GET call. - :type shared_gallery_image_id: 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'}, - 'shared_gallery_image_id': {'key': 'sharedGalleryImageId', '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 - self.shared_gallery_image_id = kwargs.get('shared_gallery_image_id', 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_07_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_07_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_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_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_07_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 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_07_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 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_07_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_07_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_07_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_07_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 `_. - - :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_07_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_07_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_07_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 or virtual - machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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_07_01.models.LinuxVMGuestPatchMode - :param assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual - machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` - **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch - assessments. The property provisionVMAgent must be true. Possible values include: - "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_07_01.models.LinuxPatchAssessmentMode - """ - - _attribute_map = { - 'patch_mode': {'key': 'patchMode', 'type': 'str'}, - 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LinuxPatchSettings, self).__init__(**kwargs) - self.patch_mode = kwargs.get('patch_mode', None) - self.assessment_mode = kwargs.get('assessment_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_07_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 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_07_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_07_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 ManagedArtifact(msrest.serialization.Model): - """The managed artifact. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The managed artifact id. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedArtifact, self).__init__(**kwargs) - self.id = kwargs['id'] - - -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_07_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_07_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 - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkInterfaceReference, self).__init__(**kwargs) - self.primary = kwargs.get('primary', None) - self.delete_option = kwargs.get('delete_option', None) - - -class NetworkProfile(msrest.serialization.Model): - """Specifies the network interfaces or the networking configuration 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_07_01.models.NetworkInterfaceReference] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations. Possible values include: - "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion - :param network_interface_configurations: Specifies the networking configurations that will be - used to create the virtual machine networking resources. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceConfiguration] - """ - - _attribute_map = { - 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterfaceReference]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineNetworkInterfaceConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkProfile, self).__init__(**kwargs) - self.network_interfaces = kwargs.get('network_interfaces', None) - self.network_api_version = kwargs.get('network_api_version', None) - self.network_interface_configurations = kwargs.get('network_interface_configurations', 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_07_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", - "Suspend". - :type action: str or ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_01.models.ManagedDiskParameters - :param delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. - :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is - used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this - value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The - default value is set to **detach**. For an ephemeral OS Disk, the default value is set to - **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values - include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes - """ - - _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'}, - 'delete_option': {'key': 'deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_07_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 OSDiskImageEncryption(DiskImageEncryption): - """Contains encryption settings for an OS disk image. - - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption - set. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OSDiskImageEncryption, self).__init__(**kwargs) - - -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. - :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_07_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 - `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. To install certificates on a virtual machine it is recommended to use the `Azure Key - Vault virtual machine extension for Linux - `_ or the `Azure - Key Vault virtual machine extension for Windows - `_. - :type secrets: list[~azure.mgmt.compute.v2021_07_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 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_07_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 or virtual - machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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_07_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 - :param assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual - machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` - **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch - assessments. The property provisionVMAgent must be true. Possible values include: - "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_07_01.models.WindowsPatchAssessmentMode - """ - - _attribute_map = { - 'patch_mode': {'key': 'patchMode', 'type': 'str'}, - 'enable_hotpatching': {'key': 'enableHotpatching', 'type': 'bool'}, - 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, - } - - 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) - self.assessment_mode = kwargs.get('assessment_mode', None) - - -class PirResource(msrest.serialization.Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PirResource, self).__init__(**kwargs) - self.name = None - self.location = None - - -class PirSharedGalleryResource(PirResource): - """Base information about the shared gallery resource in pir. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PirSharedGalleryResource, self).__init__(**kwargs) - self.unique_id = kwargs.get('unique_id', 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_07_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_07_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_07_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_07_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2021_07_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_07_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 ProxyResource(msrest.serialization.Model): - """The resource model definition for an Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PublicIPAddressSku(msrest.serialization.Model): - """Describes the public IP Sku. - - :param name: Specify public IP sku name. Possible values include: "Basic", "Standard". - :type name: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuName - :param tier: Specify public IP sku tier. Possible values include: "Regional", "Global". - :type tier: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PublicIPAddressSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -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 RecommendedMachineConfiguration(msrest.serialization.Model): - """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange - """ - - _attribute_map = { - 'v_cp_us': {'key': 'vCPUs', 'type': 'ResourceRange'}, - 'memory': {'key': 'memory', 'type': 'ResourceRange'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedMachineConfiguration, self).__init__(**kwargs) - self.v_cp_us = kwargs.get('v_cp_us', None) - self.memory = kwargs.get('memory', None) - - -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 RegionalReplicationStatus(msrest.serialization.Model): - """This is the regional replication status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region: The region to which the gallery image version is being replicated to. - :vartype region: str - :ivar state: This is the regional replication state. Possible values include: "Unknown", - "Replicating", "Completed", "Failed". - :vartype state: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationState - :ivar details: The details of the replication status. - :vartype details: str - :ivar progress: It indicates progress of the replication job. - :vartype progress: int - """ - - _validation = { - 'region': {'readonly': True}, - 'state': {'readonly': True}, - 'details': {'readonly': True}, - 'progress': {'readonly': True}, - } - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalReplicationStatus, self).__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None - - -class ReplicationStatus(msrest.serialization.Model): - """This is the replication status of the gallery image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: This is the aggregated replication status based on all the regional - replication status flags. Possible values include: "Unknown", "InProgress", "Completed", - "Failed". - :vartype aggregated_state: str or - ~azure.mgmt.compute.v2021_07_01.models.AggregatedReplicationState - :ivar summary: This is a summary of replication status for each region. - :vartype summary: list[~azure.mgmt.compute.v2021_07_01.models.RegionalReplicationStatus] - """ - - _validation = { - 'aggregated_state': {'readonly': True}, - 'summary': {'readonly': True}, - } - - _attribute_map = { - 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': '[RegionalReplicationStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationStatus, self).__init__(**kwargs) - self.aggregated_state = None - self.summary = 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_07_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 ResourceRange(msrest.serialization.Model): - """Describes the resource range. - - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int - """ - - _attribute_map = { - 'min': {'key': 'min', 'type': 'int'}, - 'max': {'key': 'max', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRange, self).__init__(**kwargs) - self.min = kwargs.get('min', None) - self.max = kwargs.get('max', None) - - -class ResourceSku(msrest.serialization.Model): - """Describes an available Compute 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 name: The name of SKU. - :vartype name: str - :ivar tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` - Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` - **Basic**. - :vartype tier: str - :ivar size: The Size of the SKU. - :vartype size: str - :ivar family: The Family of this particular SKU. - :vartype family: str - :ivar kind: The Kind of resources that are supported in this SKU. - :vartype kind: str - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2021_07_01.models.ResourceSkuCapacity - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: A list of locations and availability zones in those locations where the - SKU is available. - :vartype location_info: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSkuLocationInfo] - :ivar api_versions: The api versions that support this SKU. - :vartype api_versions: list[str] - :ivar costs: Metadata for retrieving price info. - :vartype costs: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSkuCosts] - :ivar capabilities: A name value pair to describe the capability. - :vartype capabilities: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSkuCapabilities] - :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :vartype restrictions: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSkuRestrictions] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'kind': {'readonly': True}, - 'capacity': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'costs': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'ResourceSkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'costs': {'key': 'costs', 'type': '[ResourceSkuCosts]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.location_info = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None - - -class ResourceSkuCapabilities(msrest.serialization.Model): - """Describes The SKU capabilities object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: An invariant to describe the feature. - :vartype name: str - :ivar value: An invariant if the feature is measured by quantity. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapabilities, self).__init__(**kwargs) - self.name = None - self.value = None - - -class ResourceSkuCapacity(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: The default capacity. - :vartype default: long - :ivar scale_type: The scale type applicable to the sku. Possible values include: "Automatic", - "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceSkuCapacityScaleType - """ - - _validation = { - 'minimum': {'readonly': True}, - 'maximum': {'readonly': True}, - 'default': {'readonly': True}, - 'scale_type': {'readonly': True}, - } - - _attribute_map = { - 'minimum': {'key': 'minimum', 'type': 'long'}, - 'maximum': {'key': 'maximum', 'type': 'long'}, - 'default': {'key': 'default', 'type': 'long'}, - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapacity, self).__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None - - -class ResourceSkuCosts(msrest.serialization.Model): - """Describes metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The multiplier is needed to extend the base metered cost. - :vartype quantity: long - :ivar extended_unit: An invariant to show the extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterID', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCosts, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """Describes an available Compute SKU Location Information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of the SKU. - :vartype location: str - :ivar zones: List of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Details of capabilities available to a SKU in specific zones. - :vartype zone_details: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSkuZoneDetails] - :ivar extended_locations: The names of extended locations. - :vartype extended_locations: list[str] - :ivar type: The type of the extended location. Possible values include: "EdgeZone". - :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocationType - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - 'zone_details': {'readonly': True}, - 'extended_locations': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, - 'extended_locations': {'key': 'extendedLocations', 'type': '[str]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - self.zone_details = None - self.extended_locations = None - self.type = None - - -class ResourceSkuRestrictionInfo(msrest.serialization.Model): - """Describes an available Compute SKU Restriction Information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar locations: Locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: List of availability zones where the SKU is restricted. - :vartype zones: list[str] - """ - - _validation = { - 'locations': {'readonly': True}, - 'zones': {'readonly': True}, - } - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = None - self.zones = None - - -class ResourceSkuRestrictions(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 type: The type of restrictions. Possible values include: "Location", "Zone". - :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceSkuRestrictionsType - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: The information about the restriction where the SKU cannot be used. - :vartype restriction_info: ~azure.mgmt.compute.v2021_07_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: The reason for restriction. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.compute.v2021_07_01.models.ResourceSkuRestrictionsReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'restriction_info': {'readonly': True}, - 'reason_code': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None - - -class ResourceSkusResult(msrest.serialization.Model): - """The List Resource 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 subscription. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSku] - :param next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this - URI to fetch the next page of Resource Skus. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkusResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class ResourceSkuZoneDetails(msrest.serialization.Model): - """Describes The zonal capabilities of a SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: A list of capabilities that are available for the SKU in the specified list - of zones. - :vartype capabilities: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSkuCapabilities] - """ - - _validation = { - 'name': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuZoneDetails, self).__init__(**kwargs) - self.name = None - self.capabilities = None - - -class RestorePoint(ProxyResource): - """Restore Point details. - - 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 - :param exclude_disks: List of disk resource ids that the customer wishes to exclude from the - restore point. If no disks are specified, all disks will be included. - :type exclude_disks: list[~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference] - :ivar source_metadata: Gets the details of the VM captured at the time of the restore point - creation. - :vartype source_metadata: ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceMetadata - :ivar provisioning_state: Gets the provisioning state of the restore point. - :vartype provisioning_state: str - :ivar consistency_mode: Gets the consistency mode for the restore point. Please refer to - https://aka.ms/RestorePoints for more details. Possible values include: "CrashConsistent", - "FileSystemConsistent", "ApplicationConsistent". - :vartype consistency_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ConsistencyModeTypes - :ivar provisioning_details: Gets the provisioning details set by the server during Create - restore point operation. - :vartype provisioning_details: - ~azure.mgmt.compute.v2021_07_01.models.RestorePointProvisioningDetails - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'source_metadata': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'consistency_mode': {'readonly': True}, - 'provisioning_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'exclude_disks': {'key': 'properties.excludeDisks', 'type': '[ApiEntityReference]'}, - 'source_metadata': {'key': 'properties.sourceMetadata', 'type': 'RestorePointSourceMetadata'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'consistency_mode': {'key': 'properties.consistencyMode', 'type': 'str'}, - 'provisioning_details': {'key': 'properties.provisioningDetails', 'type': 'RestorePointProvisioningDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePoint, self).__init__(**kwargs) - self.exclude_disks = kwargs.get('exclude_disks', None) - self.source_metadata = None - self.provisioning_state = None - self.consistency_mode = None - self.provisioning_details = None - - -class RestorePointCollection(Resource): - """Create or update Restore Point collection parameters. - - 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 properties of the source resource that this restore point collection is - created from. - :type source: ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties - :ivar provisioning_state: The provisioning state of the restore point collection. - :vartype provisioning_state: str - :ivar restore_point_collection_id: The unique id of the restore point collection. - :vartype restore_point_collection_id: str - :ivar restore_points: A list containing all restore points created under this restore point - collection. - :vartype restore_points: list[~azure.mgmt.compute.v2021_07_01.models.RestorePoint] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'restore_point_collection_id': {'readonly': True}, - 'restore_points': {'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': 'RestorePointCollectionSourceProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, - 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollection, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None - - -class RestorePointCollectionListResult(msrest.serialization.Model): - """The List restore point collection operation response. - - :param value: Gets the list of restore point collections. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollection] - :param next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() - with this to fetch the next page of RestorePointCollections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorePointCollection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RestorePointCollectionSourceProperties(msrest.serialization.Model): - """The properties of the source resource that this restore point collection is created from. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of the source resource used to create this restore point collection. - :vartype location: str - :param id: Resource Id of the source resource used to create this restore point collection. - :type id: str - """ - - _validation = { - 'location': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionSourceProperties, self).__init__(**kwargs) - self.location = None - self.id = kwargs.get('id', None) - - -class RestorePointCollectionUpdate(UpdateResource): - """Update Restore Point collection parameters. - - 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 properties of the source resource that this restore point collection is - created from. - :type source: ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties - :ivar provisioning_state: The provisioning state of the restore point collection. - :vartype provisioning_state: str - :ivar restore_point_collection_id: The unique id of the restore point collection. - :vartype restore_point_collection_id: str - :ivar restore_points: A list containing all restore points created under this restore point - collection. - :vartype restore_points: list[~azure.mgmt.compute.v2021_07_01.models.RestorePoint] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'restore_point_collection_id': {'readonly': True}, - 'restore_points': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'source': {'key': 'properties.source', 'type': 'RestorePointCollectionSourceProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, - 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointCollectionUpdate, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None - - -class RestorePointProvisioningDetails(msrest.serialization.Model): - """Restore Point Provisioning details. - - :param creation_time: Gets the creation time of the restore point. - :type creation_time: ~datetime.datetime - :param total_used_size_in_bytes: Gets the total size of the data in all the disks which are - part of the restore point. - :type total_used_size_in_bytes: long - :param status_code: Gets the status of the Create restore point operation. - :type status_code: int - :param status_message: Gets the status message of the Create restore point operation. - :type status_message: str - """ - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'total_used_size_in_bytes': {'key': 'totalUsedSizeInBytes', 'type': 'long'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointProvisioningDetails, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.total_used_size_in_bytes = kwargs.get('total_used_size_in_bytes', None) - self.status_code = kwargs.get('status_code', None) - self.status_message = kwargs.get('status_message', None) - - -class RestorePointSourceMetadata(msrest.serialization.Model): - """Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point creation. - - :param hardware_profile: Gets the hardware profile. - :type hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile - :param storage_profile: Gets the storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMStorageProfile - :param os_profile: Gets the OS profile. - :type os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile - :param diagnostics_profile: Gets the diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param license_type: Gets the license type, which is for bring your own license scenario. - :type license_type: str - :param vm_id: Gets the virtual machine unique id. - :type vm_id: str - :param security_profile: Gets the security profile. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param location: Location of the VM from which the restore point was created. - :type location: str - """ - - _attribute_map = { - 'hardware_profile': {'key': 'hardwareProfile', 'type': 'HardwareProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'RestorePointSourceVMStorageProfile'}, - 'os_profile': {'key': 'osProfile', 'type': 'OSProfile'}, - 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceMetadata, self).__init__(**kwargs) - self.hardware_profile = kwargs.get('hardware_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.diagnostics_profile = kwargs.get('diagnostics_profile', None) - self.license_type = kwargs.get('license_type', None) - self.vm_id = kwargs.get('vm_id', None) - self.security_profile = kwargs.get('security_profile', None) - self.location = kwargs.get('location', None) - - -class RestorePointSourceVMDataDisk(msrest.serialization.Model): - """Describes a data disk. - - :param lun: Gets the logical unit number. - :type lun: int - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes - :param disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired - size for existing OS and Data disks. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference - """ - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMDataDisk, self).__init__(**kwargs) - self.lun = kwargs.get('lun', None) - self.name = kwargs.get('name', None) - self.caching = kwargs.get('caching', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - self.disk_restore_point = kwargs.get('disk_restore_point', None) - - -class RestorePointSourceVMOSDisk(msrest.serialization.Model): - """Describes an Operating System disk. - - :param os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemType - :param encryption_settings: Gets the disk encryption settings. - :type encryption_settings: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes - :param disk_size_gb: Gets the disk size in GB. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference - """ - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': 'DiskEncryptionSettings'}, - 'name': {'key': 'name', 'type': 'str'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, - 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMOSDisk, 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.caching = kwargs.get('caching', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.managed_disk = kwargs.get('managed_disk', None) - self.disk_restore_point = kwargs.get('disk_restore_point', None) - - -class RestorePointSourceVMStorageProfile(msrest.serialization.Model): - """Describes the storage profile. - - :param os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. - :type os_disk: ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMOSDisk - :param data_disks: Gets the data disks of the VM captured at the time of the restore point - creation. - :type data_disks: list[~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMDataDisk] - """ - - _attribute_map = { - 'os_disk': {'key': 'osDisk', 'type': 'RestorePointSourceVMOSDisk'}, - 'data_disks': {'key': 'dataDisks', 'type': '[RestorePointSourceVMDataDisk]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointSourceVMStorageProfile, self).__init__(**kwargs) - self.os_disk = kwargs.get('os_disk', None) - self.data_disks = kwargs.get('data_disks', 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 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_07_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_07_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_07_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_07_01.models.RollingUpgradePolicy - :ivar running_status: Information about the current running state of the overall upgrade. - :vartype running_status: ~azure.mgmt.compute.v2021_07_01.models.RollingUpgradeRunningStatus - :ivar progress: Information about the number of virtual machine instances in each upgrade - state. - :vartype progress: ~azure.mgmt.compute.v2021_07_01.models.RollingUpgradeProgressInfo - :ivar error: Error details for this upgrade, if there are any. - :vartype error: ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_01.models.VirtualMachineScaleSetScaleInRules] - :param force_deletion: This property allows you to specify if virtual machines chosen for - removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature - in Preview). - :type force_deletion: bool - """ - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[str]'}, - 'force_deletion': {'key': 'forceDeletion', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ScaleInPolicy, self).__init__(**kwargs) - self.rules = kwargs.get('rules', None) - self.force_deletion = kwargs.get('force_deletion', 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_07_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. - - :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_07_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 - :param 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. Possible values include: - "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_07_01.models.SecurityTypes - """ - - _attribute_map = { - 'uefi_settings': {'key': 'uefiSettings', 'type': 'UefiSettings'}, - 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, - 'security_type': {'key': 'securityType', 'type': 'str'}, - } - - 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) - self.security_type = kwargs.get('security_type', None) - - -class SharedGallery(PirSharedGalleryResource): - """Specifies information about the Shared Gallery that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGallery, self).__init__(**kwargs) - - -class SharedGalleryImage(PirSharedGalleryResource): - """Specifies information about the gallery image definition that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param os_type: This property allows you to specify the type of the OS that is included in the - disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created - under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", - "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS - disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by - marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_state': {'key': 'properties.osState', 'type': 'str'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, - 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, - 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, - 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImage, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.os_state = kwargs.get('os_state', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - self.identifier = kwargs.get('identifier', None) - self.recommended = kwargs.get('recommended', None) - self.disallowed = kwargs.get('disallowed', None) - self.hyper_v_generation = kwargs.get('hyper_v_generation', None) - self.features = kwargs.get('features', None) - self.purchase_plan = kwargs.get('purchase_plan', None) - - -class SharedGalleryImageList(msrest.serialization.Model): - """The List Shared Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of shared gallery images. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImage] - :param next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with - this to fetch the next page of shared gallery images. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedGalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SharedGalleryImageVersion(PirSharedGalleryResource): - """Specifies information about the gallery image version that you want to create or update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar location: Resource location. - :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - """ - - _validation = { - 'name': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, - 'published_date': {'key': 'properties.publishedDate', 'type': 'iso-8601'}, - 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImageVersion, self).__init__(**kwargs) - self.published_date = kwargs.get('published_date', None) - self.end_of_life_date = kwargs.get('end_of_life_date', None) - - -class SharedGalleryImageVersionList(msrest.serialization.Model): - """The List Shared Gallery Image versions operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of shared gallery images versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersion] - :param next_link: The uri to fetch the next page of shared gallery image versions. Call - ListNext() with this to fetch the next page of shared gallery image versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedGalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SharedGalleryList(msrest.serialization.Model): - """The List Shared Galleries operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of shared galleries. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGallery] - :param next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this - to fetch the next page of shared galleries. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedGallery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedGalleryList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SharingProfile(msrest.serialization.Model): - """Profile for gallery sharing to subscription or tenant. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param permissions: This property allows you to specify the permission of sharing gallery. - :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** - :code:`
    `:code:`
    ` **Groups**. Possible values include: "Private", "Groups". - :type permissions: str or ~azure.mgmt.compute.v2021_07_01.models.GallerySharingPermissionTypes - :ivar groups: A list of sharing profile groups. - :vartype groups: list[~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroup] - """ - - _validation = { - 'groups': {'readonly': True}, - } - - _attribute_map = { - 'permissions': {'key': 'permissions', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[SharingProfileGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingProfile, self).__init__(**kwargs) - self.permissions = kwargs.get('permissions', None) - self.groups = None - - -class SharingProfileGroup(msrest.serialization.Model): - """Group of the gallery sharing profile. - - :param type: This property allows you to specify the type of sharing group. - :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** - :code:`
    `:code:`
    ` **AADTenants**. Possible values include: "Subscriptions", - "AADTenants". - :type type: str or ~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroupTypes - :param ids: A list of subscription/tenant ids the gallery is aimed to be shared to. - :type ids: list[str] - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'ids': {'key': 'ids', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingProfileGroup, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.ids = kwargs.get('ids', None) - - -class SharingUpdate(msrest.serialization.Model): - """Specifies information about the gallery sharing profile update. - - All required parameters must be populated in order to send to Azure. - - :param operation_type: Required. This property allows you to specify the operation type of - gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` - **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset**. Possible values - include: "Add", "Remove", "Reset". - :type operation_type: str or ~azure.mgmt.compute.v2021_07_01.models.SharingUpdateOperationTypes - :param groups: A list of sharing profile groups. - :type groups: list[~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroup] - """ - - _validation = { - 'operation_type': {'required': True}, - } - - _attribute_map = { - 'operation_type': {'key': 'operationType', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[SharingProfileGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingUpdate, self).__init__(**kwargs) - self.operation_type = kwargs['operation_type'] - self.groups = kwargs.get('groups', 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 SoftDeletePolicy(msrest.serialization.Model): - """Contains information about the soft deletion policy of the gallery. - - :param is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing - them to be recovered within retention time. - :type is_soft_delete_enabled: bool - """ - - _attribute_map = { - 'is_soft_delete_enabled': {'key': 'isSoftDeleteEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SoftDeletePolicy, self).__init__(**kwargs) - self.is_soft_delete_enabled = kwargs.get('is_soft_delete_enabled', None) - - -class SpotRestorePolicy(msrest.serialization.Model): - """Specifies the Spot-Try-Restore properties for the virtual machine scale set. :code:`
    `:code:`
    ` With this property customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically based on capacity availability and pricing constraint. - - :param enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be - tried to be restored opportunistically based on capacity availability and pricing constraints. - :type enabled: bool - :param restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the - platform will not try to restore the VMSS SPOT instances. - :type restore_timeout: str - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'restore_timeout': {'key': 'restoreTimeout', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SpotRestorePolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.restore_timeout = kwargs.get('restore_timeout', 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_07_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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - :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_07_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 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_07_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_07_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_07_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_07_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 TargetRegion(msrest.serialization.Model): - """Describes the target region information. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per - region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. - This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", - "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :type encryption: ~azure.mgmt.compute.v2021_07_01.models.EncryptionImages - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'regional_replica_count': {'key': 'regionalReplicaCount', 'type': 'int'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'EncryptionImages'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetRegion, self).__init__(**kwargs) - self.name = kwargs['name'] - self.regional_replica_count = kwargs.get('regional_replica_count', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - self.encryption = kwargs.get('encryption', 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 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_07_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_07_01.models.UpgradeOperationHistoryStatus - :ivar progress: Counts of the VMs in each state. - :vartype progress: ~azure.mgmt.compute.v2021_07_01.models.RollingUpgradeProgressInfo - :ivar error: Error Details for this upgrade if there are any. - :vartype error: ~azure.mgmt.compute.v2021_07_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_07_01.models.UpgradeOperationInvoker - :ivar target_image_reference: Image Reference details. - :vartype target_image_reference: ~azure.mgmt.compute.v2021_07_01.models.ImageReference - :ivar rollback_info: Information about OS rollback if performed. - :vartype rollback_info: ~azure.mgmt.compute.v2021_07_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_07_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_07_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling - upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2021_07_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_07_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: An enum describing the unit of usage measurement. Has constant 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_07_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 UserArtifactManage(msrest.serialization.Model): - """UserArtifactManage. - - All required parameters must be populated in order to send to Azure. - - :param install: Required. Required. The path and arguments to install the gallery application. - This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. - This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not - present, then update operation will invoke remove command on the previous version and install - command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str - """ - - _validation = { - 'install': {'required': True}, - 'remove': {'required': True}, - } - - _attribute_map = { - 'install': {'key': 'install', 'type': 'str'}, - 'remove': {'key': 'remove', 'type': 'str'}, - 'update': {'key': 'update', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactManage, self).__init__(**kwargs) - self.install = kwargs['install'] - self.remove = kwargs['remove'] - self.update = kwargs.get('update', None) - - -class UserArtifactSource(msrest.serialization.Model): - """The source image from which the Image Version is going to be created. - - All required parameters must be populated in order to send to Azure. - - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must - be a readable storage page blob. - :type default_configuration_link: str - """ - - _validation = { - 'media_link': {'required': True}, - } - - _attribute_map = { - 'media_link': {'key': 'mediaLink', 'type': 'str'}, - 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserArtifactSource, self).__init__(**kwargs) - self.media_link = kwargs['media_link'] - self.default_configuration_link = kwargs.get('default_configuration_link', 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:`
    `} :code:`
    ` To install certificates on a - virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for - Linux `_ or the - `Azure Key Vault virtual machine extension for Windows - `_. - :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_07_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_07_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_07_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_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_07_01.models.ExtendedLocation - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_07_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_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2021_07_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_07_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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_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 - :param capacity_reservation: Specifies information about the capacity reservation that is used - to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile - :param application_profile: Specifies the gallery applications that should be made available to - the VM/VMSS. - :type application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile - """ - - _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'}, - 'scheduled_events_profile': {'key': 'properties.scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, - 'user_data': {'key': 'properties.userData', 'type': 'str'}, - 'capacity_reservation': {'key': 'properties.capacityReservation', 'type': 'CapacityReservationProfile'}, - 'application_profile': {'key': 'properties.applicationProfile', 'type': 'ApplicationProfile'}, - } - - 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.scheduled_events_profile = kwargs.get('scheduled_events_profile', None) - self.user_data = kwargs.get('user_data', None) - self.capacity_reservation = kwargs.get('capacity_reservation', None) - self.application_profile = kwargs.get('application_profile', 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_07_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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: any - :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[any] - """ - - _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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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_07_01.models.VirtualMachineExtensionInstanceView - :param suppress_failures: Indicates whether failures stemming from the extension will be - suppressed (Operational failures such as not connecting to the VM will not be suppressed - regardless of this value). The default is false. - :type suppress_failures: bool - """ - - _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'}, - 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, - } - - 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) - self.suppress_failures = kwargs.get('suppress_failures', 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_07_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_07_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_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_07_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :param suppress_failures: Indicates whether failures stemming from the extension will be - suppressed (Operational failures such as not connecting to the VM will not be suppressed - regardless of this value). The default is false. - :type suppress_failures: bool - """ - - _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'}, - 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, - } - - 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) - self.suppress_failures = kwargs.get('suppress_failures', 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_07_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_07_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_07_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_07_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_07_01.models.ExtendedLocation - :param plan: Used for establishing the purchase context of any 3rd Party artifact through - MarketPlace. - :type plan: ~azure.mgmt.compute.v2021_07_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2021_07_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_07_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_07_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the - image. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.DisallowedConfiguration - :param features: - :type features: list[~azure.mgmt.compute.v2021_07_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: 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_07_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_07_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_07_01.models.LinuxParameters - """ - - _validation = { - '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.get('maximum_duration', None) - 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_07_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_07_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_07_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_07_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_07_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_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2021_07_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2021_07_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_07_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_07_01.models.InstanceViewStatus] - :param patch_status: [Preview Feature] The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2021_07_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 VirtualMachineIpTag(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(VirtualMachineIpTag, self).__init__(**kwargs) - self.ip_tag_type = kwargs.get('ip_tag_type', None) - self.tag = kwargs.get('tag', 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_07_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 VirtualMachineNetworkInterfaceConfiguration(msrest.serialization.Model): - """Describes a virtual machine network interface configurations. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The network interface 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 delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - :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 enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceIPConfiguration] - :param dscp_configuration: - :type dscp_configuration: ~azure.mgmt.compute.v2021_07_01.models.SubResource - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, - 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, - 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, - 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineNetworkInterfaceDnsSettingsConfiguration'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineNetworkInterfaceIPConfiguration]'}, - 'dscp_configuration': {'key': 'properties.dscpConfiguration', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineNetworkInterfaceConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.primary = kwargs.get('primary', None) - self.delete_option = kwargs.get('delete_option', None) - self.enable_accelerated_networking = kwargs.get('enable_accelerated_networking', None) - self.enable_fpga = kwargs.get('enable_fpga', None) - self.enable_ip_forwarding = kwargs.get('enable_ip_forwarding', 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.dscp_configuration = kwargs.get('dscp_configuration', None) - - -class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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(VirtualMachineNetworkInterfaceDnsSettingsConfiguration, self).__init__(**kwargs) - self.dns_servers = kwargs.get('dns_servers', None) - - -class VirtualMachineNetworkInterfaceIPConfiguration(msrest.serialization.Model): - """Describes a virtual machine network profile's IP configuration. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The IP configuration name. - :type name: str - :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :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_07_01.models.VirtualMachinePublicIPAddressConfiguration - :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_07_01.models.IPVersions - :param application_security_groups: Specifies an array of references to application security - group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param application_gateway_backend_address_pools: Specifies an array of references to backend - address pools of application gateways. A virtual machine can reference backend address pools of - multiple application gateways. Multiple virtual machines cannot use the same application - gateway. - :type application_gateway_backend_address_pools: - list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address - pools of load balancers. A virtual machine can reference backend address pools of one public - and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load - balancer]. - :type load_balancer_backend_address_pools: - list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachinePublicIPAddressConfiguration'}, - 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, - 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, - 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, - 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineNetworkInterfaceIPConfiguration, 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_security_groups = kwargs.get('application_security_groups', None) - self.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', None) - self.load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools', 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_07_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_07_01.models.LastPatchInstallationSummary - :ivar configuration_statuses: The enablement status of the specified patchMode. - :vartype configuration_statuses: - list[~azure.mgmt.compute.v2021_07_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 VirtualMachinePublicIPAddressConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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 sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku - :param idle_timeout_in_minutes: The idle timeout of the public IP address. - :type idle_timeout_in_minutes: int - :param delete_option: Specify what happens to the public IP address when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - :param dns_settings: The dns settings to be applied on the publicIP addresses . - :type dns_settings: - ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_07_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_07_01.models.IPVersions - :param public_ip_allocation_method: Specify the public IP allocation type. Possible values - include: "Dynamic", "Static". - :type public_ip_allocation_method: str or - ~azure.mgmt.compute.v2021_07_01.models.PublicIPAllocationMethod - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, - 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachinePublicIPAddressDnsSettingsConfiguration'}, - 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineIpTag]'}, - 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, - 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, - 'public_ip_allocation_method': {'key': 'properties.publicIPAllocationMethod', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachinePublicIPAddressConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.sku = kwargs.get('sku', None) - self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) - self.delete_option = kwargs.get('delete_option', 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) - self.public_ip_allocation_method = kwargs.get('public_ip_allocation_method', None) - - -class VirtualMachinePublicIPAddressDnsSettingsConfiguration(msrest.serialization.Model): - """Describes a virtual machines 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 prefix of the PublicIPAddress - resources that will be created. The generated name label is the concatenation of the domain - name label and vm network profile unique ID. - :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(VirtualMachinePublicIPAddressDnsSettingsConfiguration, self).__init__(**kwargs) - self.domain_name_label = kwargs['domain_name_label'] - - -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_07_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: - list[~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_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_07_01.models.ExtendedLocation - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2021_07_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. zoneBalance property can only be set if the zones property of the - scale set contains more than one zone. If there are no zones or only one zone specified, then - zoneBalance property should not be set. - :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_07_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_07_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_07_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the - Virtual Machine Scale Set. - :type scale_in_policy: ~azure.mgmt.compute.v2021_07_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_07_01.models.OrchestrationMode - :param spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale - set. - :type spot_restore_policy: ~azure.mgmt.compute.v2021_07_01.models.SpotRestorePolicy - """ - - _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'}, - 'spot_restore_policy': {'key': 'properties.spotRestorePolicy', 'type': 'SpotRestorePolicy'}, - } - - 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) - self.spot_restore_policy = kwargs.get('spot_restore_policy', 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_07_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_07_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_07_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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] - :param suppress_failures: Indicates whether failures stemming from the extension will be - suppressed (Operational failures such as not connecting to the VM will not be suppressed - regardless of this value). The default is false. - :type suppress_failures: bool - """ - - _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]'}, - 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, - } - - 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) - self.suppress_failures = kwargs.get('suppress_failures', 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_07_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_07_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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] - :param suppress_failures: Indicates whether failures stemming from the extension will be - suppressed (Operational failures such as not connecting to the VM will not be suppressed - regardless of this value). The default is false. - :type suppress_failures: bool - """ - - _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]'}, - 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, - } - - 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) - self.suppress_failures = kwargs.get('suppress_failures', 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_07_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_07_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_07_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary - :ivar extensions: The extensions information. - :vartype extensions: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] - :ivar orchestration_services: The orchestration services information. - :vartype orchestration_services: - list[~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - """ - - _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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion - """ - - _attribute_map = { - 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - } - - 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) - self.network_api_version = kwargs.get('network_api_version', 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_07_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_07_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_07_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_07_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2021_07_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_07_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. - :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_07_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 - `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machines in the scale set. To install certificates on a virtual machine it is recommended to - use the `Azure Key Vault virtual machine extension for Linux - `_ or the `Azure - Key Vault virtual machine extension for Windows - `_. - :type secrets: list[~azure.mgmt.compute.v2021_07_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 sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku - :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_07_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_07_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_07_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_07_01.models.IPVersion - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible - values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, - '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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.sku = kwargs.get('sku', None) - 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) - self.delete_option = kwargs.get('delete_option', 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_07_01.models.Sku - :ivar capacity: Specifies the number of virtual machines in the scale set. - :vartype capacity: ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_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_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: - ~azure.mgmt.compute.v2021_07_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_07_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the - Virtual Machine Scale Set. - :type scale_in_policy: ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: - ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. - Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - """ - - _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'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating - networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion - """ - - _attribute_map = { - 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, - 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, - 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, - } - - 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) - self.network_api_version = kwargs.get('network_api_version', 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_07_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_07_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_07_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_07_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2021_07_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_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible - values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, - 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, - 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, - } - - 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) - self.delete_option = kwargs.get('delete_option', 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_07_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2021_07_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_07_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: - ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: - ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: - ~azure.mgmt.compute.v2021_07_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_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_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_07_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_07_01.models.Plan - :ivar resources: The virtual machine child extension resources. - :vartype resources: list[~azure.mgmt.compute.v2021_07_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_07_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_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_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: - ~azure.mgmt.compute.v2021_07_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_07_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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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_07_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_07_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}, - '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'}, - '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(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 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: 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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :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_07_01.models.VirtualMachineExtensionInstanceView - :param suppress_failures: Indicates whether failures stemming from the extension will be - suppressed (Operational failures such as not connecting to the VM will not be suppressed - regardless of this value). The default is false. - :type suppress_failures: bool - """ - - _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'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineExtensionInstanceView'}, - 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, - } - - 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) - self.suppress_failures = kwargs.get('suppress_failures', 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_07_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_07_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: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :param suppress_failures: Indicates whether failures stemming from the extension will be - suppressed (Operational failures such as not connecting to the VM will not be suppressed - regardless of this value). The default is false. - :type suppress_failures: bool - """ - - _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'}, - 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, - } - - 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) - self.suppress_failures = kwargs.get('suppress_failures', 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(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) - self.instance_ids = kwargs.get('instance_ids', None) - - -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 = { - 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) - self.instance_ids = kwargs['instance_ids'] - - -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. - - :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_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: - ~azure.mgmt.compute.v2021_07_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The health status for the VM. - :vartype vm_health: ~azure.mgmt.compute.v2021_07_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_07_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_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 = { - 'vm_health': {'readonly': True}, - 'assigned_host': {'readonly': True}, - } - - _attribute_map = { - '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(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 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. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2021_07_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 - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): - """Describes a virtual machine scale set VM network profile. - - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: - list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfiguration] - """ - - _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_07_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: - ~azure.mgmt.compute.v2021_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile - :param user_data: UserData for the virtual machines in the scale set, 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 - :param capacity_reservation: Specifies the capacity reservation related details of a scale set. - :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile - :param application_profile: Specifies the gallery applications that should be made available to - the VM/VMSS. - :type application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile - """ - - _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'}, - 'capacity_reservation': {'key': 'capacityReservation', 'type': 'CapacityReservationProfile'}, - 'application_profile': {'key': 'applicationProfile', 'type': 'ApplicationProfile'}, - } - - 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) - self.capacity_reservation = kwargs.get('capacity_reservation', None) - self.application_profile = kwargs.get('application_profile', 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 = { - 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, - 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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 VirtualMachineSize(msrest.serialization.Model): - """Describes the properties of a VM size. - - :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. For - Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM - uses. For accurate vCPU count, please refer to - https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or - https://docs.microsoft.com/rest/api/compute/resourceskus/list. - :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 = { - '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(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 VirtualMachineSizeListResult(msrest.serialization.Model): - """The List Virtual Machine operation response. - - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSize] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineSizeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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 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_07_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_07_01.models.PatchAssessmentState - """ - - _validation = { - '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 = { - '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(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 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: The number of instances having a particular 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(VirtualMachineStatusCodeCount, self).__init__(**kwargs) - self.code = None - self.count = None - - -class VirtualMachineUpdate(UpdateResource): - """Describes a Virtual Machine Update. - - 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_07_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_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_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the - virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_07_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_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual - machine. - :type security_profile: ~azure.mgmt.compute.v2021_07_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_07_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 `Availability sets overview - `_. - :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance - and updates 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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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_07_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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_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 - :param capacity_reservation: Specifies information about the capacity reservation that is used - to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile - :param application_profile: Specifies the gallery applications that should be made available to - the VM/VMSS. - :type application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'instance_view': {'readonly': True}, - 'vm_id': {'readonly': True}, - } - - _attribute_map = { - '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'}, - 'scheduled_events_profile': {'key': 'properties.scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, - 'user_data': {'key': 'properties.userData', 'type': 'str'}, - 'capacity_reservation': {'key': 'properties.capacityReservation', 'type': 'CapacityReservationProfile'}, - 'application_profile': {'key': 'properties.applicationProfile', 'type': 'ApplicationProfile'}, - } - - def __init__( - self, - **kwargs - ): - 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.scheduled_events_profile = kwargs.get('scheduled_events_profile', None) - self.user_data = kwargs.get('user_data', None) - self.capacity_reservation = kwargs.get('capacity_reservation', None) - self.application_profile = kwargs.get('application_profile', None) - - -class VMGalleryApplication(msrest.serialization.Model): - """Specifies the required information to reference a compute gallery application version. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. Optional, Specifies a passthrough value for more generic context. - :type tags: str - :param order: Optional, Specifies the order in which the packages have to be installed. - :type order: int - :param package_reference_id: Required. Specifies the GalleryApplicationVersion resource id on - the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. - :type package_reference_id: str - :param configuration_reference: Optional, Specifies the uri to an azure blob that will replace - the default configuration for the package if provided. - :type configuration_reference: str - """ - - _validation = { - 'package_reference_id': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, - 'order': {'key': 'order', 'type': 'int'}, - 'package_reference_id': {'key': 'packageReferenceId', 'type': 'str'}, - 'configuration_reference': {'key': 'configurationReference', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMGalleryApplication, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.order = kwargs.get('order', None) - self.package_reference_id = kwargs['package_reference_id'] - self.configuration_reference = kwargs.get('configuration_reference', 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 - """ - - _attribute_map = { - 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) - self.active_placement_group_id = kwargs.get('active_placement_group_id', None) - - -class VMSizeProperties(msrest.serialization.Model): - """Specifies VM Size Property settings on the virtual machine. - - :param v_cpus_available: Specifies the number of vCPUs available for the VM. - :code:`
    `:code:`
    ` When this property is not specified in the request body the default - behavior is to set it to the value of vCPUs available for that VM size exposed in api response - of `List all available virtual machine sizes in a region - `_ . - :type v_cpus_available: int - :param v_cpus_per_core: Specifies the vCPU to physical core ratio. :code:`
    `:code:`
    ` - When this property is not specified in the request body the default behavior is set to the - value of vCPUsPerCore for the VM Size exposed in api response of `List all available virtual - machine sizes in a region - `_ - :code:`
    `:code:`
    ` Setting this property to 1 also means that hyper-threading is - disabled. - :type v_cpus_per_core: int - """ - - _attribute_map = { - 'v_cpus_available': {'key': 'vCPUsAvailable', 'type': 'int'}, - 'v_cpus_per_core': {'key': 'vCPUsPerCore', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(VMSizeProperties, self).__init__(**kwargs) - self.v_cpus_available = kwargs.get('v_cpus_available', None) - self.v_cpus_per_core = kwargs.get('v_cpus_per_core', 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_07_01.models.AdditionalUnattendContent] - :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on - Windows. - :type patch_settings: ~azure.mgmt.compute.v2021_07_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows - PowerShell. - :type win_rm: ~azure.mgmt.compute.v2021_07_01.models.WinRMConfiguration - """ - - _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_07_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 = { - '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(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 WinRMConfiguration(msrest.serialization.Model): - """Describes Windows Remote Management configuration of the VM. - - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2021_07_01.models.WinRMListener] - """ - - _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_07_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:`
    `} :code:`
    ` To install certificates on a - virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for - Linux `_ or the - `Azure Key Vault virtual machine extension for Windows - `_. - :type certificate_url: str - """ - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py index 9a9e58ab2298..ac796fe3957b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py @@ -17,13 +17,13 @@ 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 + :ivar 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 - :param hibernation_enabled: The flag that enables or disables hibernation capability on the VM. - :type hibernation_enabled: bool + :vartype ultra_ssd_enabled: bool + :ivar hibernation_enabled: The flag that enables or disables hibernation capability on the VM. + :vartype hibernation_enabled: bool """ _attribute_map = { @@ -38,6 +38,16 @@ def __init__( hibernation_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype ultra_ssd_enabled: bool + :keyword hibernation_enabled: The flag that enables or disables hibernation capability on the + VM. + :paramtype hibernation_enabled: bool + """ super(AdditionalCapabilities, self).__init__(**kwargs) self.ultra_ssd_enabled = ultra_ssd_enabled self.hibernation_enabled = hibernation_enabled @@ -46,21 +56,21 @@ def __init__( 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. - :param pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only acceptable values to pass in are None and "OobeSystem". The default value is None. - :type pass_name: str - :param component_name: The component name. Currently, the only allowable value is + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and "Microsoft-Windows-Shell-Setup". The default value is None. - :type component_name: str - :param setting_name: Specifies the name of the setting to which the content applies. Possible + :vartype component_name: str + :ivar 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_07_01.models.SettingNames - :param content: Specifies the XML formatted content that is added to the unattend.xml file for + :vartype setting_name: str or ~azure.mgmt.compute.v2021_07_01.models.SettingNames + :ivar 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 + :vartype content: str """ _attribute_map = { @@ -79,6 +89,23 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword pass_name: The pass name. Currently, the only allowable value is OobeSystem. The only + acceptable values to pass in are None and "OobeSystem". The default value is None. + :paramtype pass_name: str + :keyword component_name: The component name. Currently, the only allowable value is + Microsoft-Windows-Shell-Setup. The only acceptable values to pass in are None and + "Microsoft-Windows-Shell-Setup". The default value is None. + :paramtype component_name: str + :keyword setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :paramtype setting_name: str or ~azure.mgmt.compute.v2021_07_01.models.SettingNames + :keyword 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. + :paramtype content: str + """ super(AdditionalUnattendContent, self).__init__(**kwargs) self.pass_name = pass_name self.component_name = component_name @@ -89,9 +116,9 @@ def __init__( class ApiEntityReference(msrest.serialization.Model): """The API entity reference. - :param id: The ARM resource id in the form of + :ivar id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :type id: str + :vartype id: str """ _attribute_map = { @@ -104,6 +131,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ super(ApiEntityReference, self).__init__(**kwargs) self.id = id @@ -111,16 +143,16 @@ def __init__( class ApiError(msrest.serialization.Model): """Api error. - :param details: The Api error details. - :type details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] - :param innererror: The Api inner error. - :type innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -141,6 +173,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiError, self).__init__(**kwargs) self.details = details self.innererror = innererror @@ -152,12 +196,12 @@ def __init__( class ApiErrorBase(msrest.serialization.Model): """Api error base. - :param code: The error code. - :type code: str - :param target: The target of the particular error. - :type target: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -174,6 +218,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ super(ApiErrorBase, self).__init__(**kwargs) self.code = code self.target = target @@ -183,9 +235,10 @@ def __init__( class ApplicationProfile(msrest.serialization.Model): """Contains the list of gallery applications that should be made available to the VM/VMSS. - :param gallery_applications: Specifies the gallery applications that should be made available - to the VM/VMSS. - :type gallery_applications: list[~azure.mgmt.compute.v2021_07_01.models.VMGalleryApplication] + :ivar gallery_applications: Specifies the gallery applications that should be made available to + the VM/VMSS. + :vartype gallery_applications: + list[~azure.mgmt.compute.v2021_07_01.models.VMGalleryApplication] """ _attribute_map = { @@ -198,6 +251,12 @@ def __init__( gallery_applications: Optional[List["VMGalleryApplication"]] = None, **kwargs ): + """ + :keyword gallery_applications: Specifies the gallery applications that should be made available + to the VM/VMSS. + :paramtype gallery_applications: + list[~azure.mgmt.compute.v2021_07_01.models.VMGalleryApplication] + """ super(ApplicationProfile, self).__init__(**kwargs) self.gallery_applications = gallery_applications @@ -205,16 +264,16 @@ def __init__( 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 + :ivar 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 + :vartype enable_automatic_os_upgrade: bool + :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default + value is false. + :vartype disable_automatic_rollback: bool """ _attribute_map = { @@ -229,6 +288,18 @@ def __init__( disable_automatic_rollback: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype enable_automatic_os_upgrade: bool + :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :paramtype disable_automatic_rollback: bool + """ super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) self.enable_automatic_os_upgrade = enable_automatic_os_upgrade self.disable_automatic_rollback = disable_automatic_rollback @@ -239,9 +310,9 @@ class AutomaticOSUpgradeProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is supported on the image. - :type automatic_os_upgrade_supported: bool + :vartype automatic_os_upgrade_supported: bool """ _validation = { @@ -258,6 +329,11 @@ def __init__( automatic_os_upgrade_supported: bool, **kwargs ): + """ + :keyword automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :paramtype automatic_os_upgrade_supported: bool + """ super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) self.automatic_os_upgrade_supported = automatic_os_upgrade_supported @@ -265,15 +341,15 @@ def __init__( 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 + :ivar 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 + :vartype enabled: bool + :ivar 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). + :vartype grace_period: str """ _attribute_map = { @@ -288,6 +364,17 @@ def __init__( grace_period: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :paramtype enabled: bool + :keyword 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). + :paramtype grace_period: str + """ super(AutomaticRepairsPolicy, self).__init__(**kwargs) self.enabled = enabled self.grace_period = grace_period @@ -306,10 +393,10 @@ class Resource(msrest.serialization.Model): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -334,6 +421,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -355,25 +448,25 @@ class AvailabilitySet(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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_07_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_07_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: + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :ivar 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_07_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ @@ -412,6 +505,28 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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'. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + """ super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -426,11 +541,11 @@ class AvailabilitySetListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of availability sets. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.AvailabilitySet] - :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.AvailabilitySet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -449,6 +564,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ super(AvailabilitySetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -457,8 +579,8 @@ def __init__( class UpdateResource(msrest.serialization.Model): """The Update Resource model definition. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -471,6 +593,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResource, self).__init__(**kwargs) self.tags = tags @@ -480,20 +606,20 @@ class AvailabilitySetUpdate(UpdateResource): 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_07_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_07_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: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku of the availability set. + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :ivar 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_07_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ @@ -523,6 +649,23 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku of the availability set. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + """ super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count @@ -589,6 +732,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailablePatchSummary, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -603,7 +748,7 @@ def __init__( 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. + :ivar 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 @@ -615,7 +760,7 @@ class BillingProfile(msrest.serialization.Model): :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 + :vartype max_price: float """ _attribute_map = { @@ -628,6 +773,21 @@ def __init__( max_price: Optional[float] = None, **kwargs ): + """ + :keyword 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. + :paramtype max_price: float + """ super(BillingProfile, self).__init__(**kwargs) self.max_price = max_price @@ -635,12 +795,12 @@ def __init__( 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 + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar 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 + :vartype storage_uri: str """ _attribute_map = { @@ -655,6 +815,14 @@ def __init__( storage_uri: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword 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. + :paramtype storage_uri: str + """ super(BootDiagnostics, self).__init__(**kwargs) self.enabled = enabled self.storage_uri = storage_uri @@ -694,6 +862,8 @@ def __init__( self, **kwargs ): + """ + """ super(BootDiagnosticsInstanceView, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -713,22 +883,22 @@ class CapacityReservation(Resource): :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 resource for which capacity needs be reserved. The SKU name - and capacity is required to be set. Currently VM Skus with the capability called + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Required. SKU of the resource for which capacity needs be reserved. The SKU name and + capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.Sku - :param zones: Availability Zone to use for this capacity reservation. The zone has to be single + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :ivar zones: Availability Zone to use for this capacity reservation. The zone has to be single value and also should be part for the list of zones specified during the capacity reservation group creation. The zone can be assigned only during creation. If not provided, the reservation supports only non-zonal deployments. If provided, enforces VM/VMSS using this capacity reservation to be in same zone. - :type zones: list[str] + :vartype zones: list[str] :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. :vartype reservation_id: str @@ -781,6 +951,24 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Required. SKU of the resource for which capacity needs be reserved. The SKU name + and capacity is required to be set. Currently VM Skus with the capability called + 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs + in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported + values. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :keyword zones: Availability Zone to use for this capacity reservation. The zone has to be + single value and also should be part for the list of zones specified during the capacity + reservation group creation. The zone can be assigned only during creation. If not provided, the + reservation supports only non-zonal deployments. If provided, enforces VM/VMSS using this + capacity reservation to be in same zone. + :paramtype zones: list[str] + """ super(CapacityReservation, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.zones = zones @@ -804,15 +992,15 @@ class CapacityReservationGroup(Resource): :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 Zones to use for this capacity reservation group. The zones can be + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar zones: Availability Zones to use for this capacity reservation group. The zones can be assigned only during creation. If not provided, the group supports only regional resources in the region. If provided, enforces each capacity reservation in the group to be in one of the zones. - :type zones: list[str] + :vartype zones: list[str] :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to capacity reservation group. :vartype capacity_reservations: @@ -857,6 +1045,17 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword zones: Availability Zones to use for this capacity reservation group. The zones can be + assigned only during creation. If not provided, the group supports only regional resources in + the region. If provided, enforces each capacity reservation in the group to be in one of the + zones. + :paramtype zones: list[str] + """ super(CapacityReservationGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.capacity_reservations = None @@ -887,6 +1086,8 @@ def __init__( self, **kwargs ): + """ + """ super(CapacityReservationGroupInstanceView, self).__init__(**kwargs) self.capacity_reservations = None @@ -896,11 +1097,11 @@ class CapacityReservationGroupListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of capacity reservation groups. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroup] - :param next_link: The URI to fetch the next page of capacity reservation groups. Call - ListNext() with this URI to fetch the next page of capacity reservation groups. - :type next_link: str + :ivar value: Required. The list of capacity reservation groups. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroup] + :ivar next_link: The URI to fetch the next page of capacity reservation groups. Call ListNext() + with this URI to fetch the next page of capacity reservation groups. + :vartype next_link: str """ _validation = { @@ -919,6 +1120,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of capacity reservation groups. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroup] + :keyword next_link: The URI to fetch the next page of capacity reservation groups. Call + ListNext() with this URI to fetch the next page of capacity reservation groups. + :paramtype next_link: str + """ super(CapacityReservationGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -929,8 +1137,8 @@ class CapacityReservationGroupUpdate(UpdateResource): 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] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to capacity reservation group. :vartype capacity_reservations: @@ -964,6 +1172,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(CapacityReservationGroupUpdate, self).__init__(tags=tags, **kwargs) self.capacity_reservations = None self.virtual_machines_associated = None @@ -973,10 +1185,11 @@ def __init__( class CapacityReservationInstanceView(msrest.serialization.Model): """The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar utilization_info: Unutilized capacity of the capacity reservation. + :vartype utilization_info: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -991,6 +1204,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword utilization_info: Unutilized capacity of the capacity reservation. + :paramtype utilization_info: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(CapacityReservationInstanceView, self).__init__(**kwargs) self.utilization_info = utilization_info self.statuses = statuses @@ -1001,10 +1221,11 @@ class CapacityReservationInstanceViewWithName(CapacityReservationInstanceView): Variables are only populated by the server, and will be ignored when sending a request. - :param utilization_info: Unutilized capacity of the capacity reservation. - :type utilization_info: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar utilization_info: Unutilized capacity of the capacity reservation. + :vartype utilization_info: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] :ivar name: The name of the capacity reservation. :vartype name: str """ @@ -1026,6 +1247,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword utilization_info: Unutilized capacity of the capacity reservation. + :paramtype utilization_info: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUtilization + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(CapacityReservationInstanceViewWithName, self).__init__(utilization_info=utilization_info, statuses=statuses, **kwargs) self.name = None @@ -1035,11 +1263,11 @@ class CapacityReservationListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of capacity reservations. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] - :param next_link: The URI to fetch the next page of capacity reservations. Call ListNext() with + :ivar value: Required. The list of capacity reservations. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] + :ivar next_link: The URI to fetch the next page of capacity reservations. Call ListNext() with this URI to fetch the next page of capacity reservations. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1058,6 +1286,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of capacity reservations. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] + :keyword next_link: The URI to fetch the next page of capacity reservations. Call ListNext() + with this URI to fetch the next page of capacity reservations. + :paramtype next_link: str + """ super(CapacityReservationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1066,11 +1301,11 @@ def __init__( class CapacityReservationProfile(msrest.serialization.Model): """The parameters of a capacity reservation Profile. - :param capacity_reservation_group: Specifies the capacity reservation group resource id that + :ivar capacity_reservation_group: Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset vm instances provided enough capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more details. - :type capacity_reservation_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :vartype capacity_reservation_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource """ _attribute_map = { @@ -1083,6 +1318,13 @@ def __init__( capacity_reservation_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword capacity_reservation_group: Specifies the capacity reservation group resource id that + should be used for allocating the virtual machine or scaleset vm instances provided enough + capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more + details. + :paramtype capacity_reservation_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + """ super(CapacityReservationProfile, self).__init__(**kwargs) self.capacity_reservation_group = capacity_reservation_group @@ -1092,14 +1334,14 @@ class CapacityReservationUpdate(UpdateResource): 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 resource for which capacity needs be reserved. The SKU name and capacity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. :vartype reservation_id: str @@ -1140,6 +1382,16 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: SKU of the resource for which capacity needs be reserved. The SKU name and + capacity is required to be set. Currently VM Skus with the capability called + 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs + in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported + values. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + """ super(CapacityReservationUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.reservation_id = None @@ -1172,6 +1424,8 @@ def __init__( self, **kwargs ): + """ + """ super(CapacityReservationUtilization, self).__init__(**kwargs) self.virtual_machines_allocated = None @@ -1187,8 +1441,8 @@ class PirCommunityGalleryResource(msrest.serialization.Model): :vartype location: str :ivar type: Resource type. :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str """ _validation = { @@ -1210,6 +1464,10 @@ def __init__( unique_id: Optional[str] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + """ super(PirCommunityGalleryResource, self).__init__(**kwargs) self.name = None self.location = None @@ -1228,8 +1486,8 @@ class CommunityGallery(PirCommunityGalleryResource): :vartype location: str :ivar type: Resource type. :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str """ _validation = { @@ -1251,6 +1509,10 @@ def __init__( unique_id: Optional[str] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + """ super(CommunityGallery, self).__init__(unique_id=unique_id, **kwargs) @@ -1265,35 +1527,35 @@ class CommunityGalleryImage(PirCommunityGalleryResource): :vartype location: str :ivar type: Resource type. :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan """ _validation = { @@ -1333,6 +1595,37 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + """ super(CommunityGalleryImage, self).__init__(unique_id=unique_id, **kwargs) self.os_type = os_type self.os_state = os_state @@ -1356,14 +1649,14 @@ class CommunityGalleryImageVersion(PirCommunityGalleryResource): :vartype location: str :ivar type: Resource type. :vartype type: str - :param unique_id: The unique id of this community gallery. - :type unique_id: str - :param published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version Definition. This + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str + :ivar published_date: The published date of the gallery image version Definition. This property + can be used for decommissioning purposes. This property is updatable. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime + :vartype end_of_life_date: ~datetime.datetime """ _validation = { @@ -1389,6 +1682,16 @@ def __init__( end_of_life_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + :keyword published_date: The published date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype published_date: ~datetime.datetime + :keyword end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + """ super(CommunityGalleryImageVersion, self).__init__(unique_id=unique_id, **kwargs) self.published_date = published_date self.end_of_life_date = end_of_life_date @@ -1415,6 +1718,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -1460,6 +1765,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -1476,44 +1783,44 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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_07_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :ivar 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_07_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :ivar 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_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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_07_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :ivar 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_07_01.models.ManagedDiskParameters - :param to_be_detached: Specifies whether the data disk is in process of detachment from the + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - :type to_be_detached: bool + :vartype 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. @@ -1522,7 +1829,7 @@ class DataDisk(msrest.serialization.Model): 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 + :ivar 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 @@ -1532,13 +1839,13 @@ class DataDisk(msrest.serialization.Model): 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_07_01.models.DiskDetachOptionTypes - :param delete_option: Specifies whether data disk should be deleted or detached upon VM + :vartype detach_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDetachOptionTypes + :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` The default value is set to **detach**. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes """ _validation = { @@ -1582,6 +1889,63 @@ def __init__( delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype lun: int + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + :keyword 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". + :paramtype detach_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDetachOptionTypes + :keyword delete_option: Specifies whether data disk should be deleted or detached upon VM + deletion.:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the data disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** + If this value is used, the data disk is retained after VM is deleted.:code:`
    `:code:`
    ` + The default value is set to **detach**. Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -1621,6 +1985,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -1628,9 +1994,9 @@ def __init__( class DiskImageEncryption(msrest.serialization.Model): """This is the disk image encryption base class. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str + :vartype disk_encryption_set_id: str """ _attribute_map = { @@ -1643,6 +2009,11 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ super(DiskImageEncryption, self).__init__(**kwargs) self.disk_encryption_set_id = disk_encryption_set_id @@ -1652,13 +2023,13 @@ class DataDiskImageEncryption(DiskImageEncryption): All required parameters must be populated in order to send to Azure. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str - :param lun: Required. This property specifies the logical unit number of the data disk. This + :vartype disk_encryption_set_id: str + :ivar lun: Required. This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - :type lun: int + :vartype lun: int """ _validation = { @@ -1677,6 +2048,15 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ super(DataDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) self.lun = lun @@ -1694,29 +2074,29 @@ class DedicatedHost(Resource): :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_07_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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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_07_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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_07_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2021_07_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. @@ -1767,6 +2147,28 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2021_07_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain @@ -1782,11 +2184,11 @@ def __init__( 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 + :ivar vm_size: VM size in terms of which the unutilized capacity is represented. + :vartype vm_size: str + :ivar count: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - :type count: float + :vartype count: float """ _attribute_map = { @@ -1801,6 +2203,13 @@ def __init__( count: Optional[float] = None, **kwargs ): + """ + :keyword vm_size: VM size in terms of which the unutilized capacity is represented. + :paramtype vm_size: str + :keyword count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :paramtype count: float + """ super(DedicatedHostAllocatableVM, self).__init__(**kwargs) self.vm_size = vm_size self.count = count @@ -1809,9 +2218,10 @@ def __init__( class DedicatedHostAvailableCapacity(msrest.serialization.Model): """Dedicated host unutilized capacity. - :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + :ivar 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_07_01.models.DedicatedHostAllocatableVM] + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { @@ -1824,6 +2234,12 @@ def __init__( allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype allocatable_v_ms: + list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostAllocatableVM] + """ super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) self.allocatable_v_ms = allocatable_v_ms @@ -1841,27 +2257,27 @@ class DedicatedHostGroup(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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_07_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_07_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -1897,6 +2313,24 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -1908,8 +2342,8 @@ def __init__( 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_07_01.models.DedicatedHostInstanceViewWithName] + :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostInstanceViewWithName] """ _attribute_map = { @@ -1922,6 +2356,11 @@ def __init__( hosts: Optional[List["DedicatedHostInstanceViewWithName"]] = None, **kwargs ): + """ + :keyword hosts: List of instance view of the dedicated hosts under the dedicated host group. + :paramtype hosts: + list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostInstanceViewWithName] + """ super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) self.hosts = hosts @@ -1931,11 +2370,11 @@ class DedicatedHostGroupListResult(msrest.serialization.Model): 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_07_01.models.DedicatedHostGroup] - :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostGroup] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -1954,6 +2393,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostGroup] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1964,25 +2410,25 @@ class DedicatedHostGroupUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype zones: list[str] + :ivar platform_fault_domain_count: Number of fault domains that the host group can span. + :vartype 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_07_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_07_01.models.DedicatedHostGroupInstanceView - :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + :ivar 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 + :vartype support_automatic_placement: bool """ _validation = { @@ -2009,6 +2455,22 @@ def __init__( support_automatic_placement: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype zones: list[str] + :keyword platform_fault_domain_count: Number of fault domains that the host group can span. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype support_automatic_placement: bool + """ super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count @@ -2025,10 +2487,11 @@ class DedicatedHostInstanceView(msrest.serialization.Model): :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_07_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2021_07_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ _validation = { @@ -2048,6 +2511,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2021_07_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceView, self).__init__(**kwargs) self.asset_id = None self.available_capacity = available_capacity @@ -2062,10 +2532,11 @@ class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): :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_07_01.models.DedicatedHostAvailableCapacity - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2021_07_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] :ivar name: The name of the dedicated host. :vartype name: str """ @@ -2089,6 +2560,13 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2021_07_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(DedicatedHostInstanceViewWithName, self).__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) self.name = None @@ -2098,11 +2576,11 @@ class DedicatedHostListResult(msrest.serialization.Model): 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_07_01.models.DedicatedHost] - :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHost] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -2121,6 +2599,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.DedicatedHost] + :keyword 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. + :paramtype next_link: str + """ super(DedicatedHostListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2131,24 +2616,24 @@ class DedicatedHostUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar 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 + :vartype 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_07_01.models.SubResourceReadOnly] - :param license_type: Specifies the software license type that will be applied to the VMs + :ivar 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_07_01.models.DedicatedHostLicenseTypes + :vartype license_type: str or ~azure.mgmt.compute.v2021_07_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. @@ -2187,6 +2672,23 @@ def __init__( license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword 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. + :paramtype auto_replace_on_failure: bool + :keyword 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". + :paramtype license_type: str or + ~azure.mgmt.compute.v2021_07_01.models.DedicatedHostLicenseTypes + """ super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure @@ -2201,11 +2703,13 @@ def __init__( 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_07_01.models.BootDiagnostics + :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `\ **NOTE**\ : If storageUri is + being specified then ensure that the storage account is in the same region and subscription as + the VM. :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. + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_07_01.models.BootDiagnostics """ _attribute_map = { @@ -2218,6 +2722,15 @@ def __init__( boot_diagnostics: Optional["BootDiagnostics"] = None, **kwargs ): + """ + :keyword boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `\ **NOTE**\ : If storageUri is + being specified then ensure that the storage account is in the same region and subscription as + the VM. :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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_07_01.models.BootDiagnostics + """ super(DiagnosticsProfile, self).__init__(**kwargs) self.boot_diagnostics = boot_diagnostics @@ -2225,10 +2738,10 @@ def __init__( 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 + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values include: "Local". - :type option: str or ~azure.mgmt.compute.v2021_07_01.models.DiffDiskOptions - :param placement: Specifies the ephemeral disk placement for operating system + :vartype option: str or ~azure.mgmt.compute.v2021_07_01.models.DiffDiskOptions + :ivar 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:`
    ` @@ -2236,7 +2749,7 @@ class DiffDiskSettings(msrest.serialization.Model): https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/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_07_01.models.DiffDiskPlacement + :vartype placement: str or ~azure.mgmt.compute.v2021_07_01.models.DiffDiskPlacement """ _attribute_map = { @@ -2251,6 +2764,20 @@ def __init__( placement: Optional[Union[str, "DiffDiskPlacement"]] = None, **kwargs ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2021_07_01.models.DiffDiskOptions + :keyword 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/azure/virtual-machines/windows/sizes and Linux VM at + https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a + cache disk. Possible values include: "CacheDisk", "ResourceDisk". + :paramtype placement: str or ~azure.mgmt.compute.v2021_07_01.models.DiffDiskPlacement + """ super(DiffDiskSettings, self).__init__(**kwargs) self.option = option self.placement = placement @@ -2259,8 +2786,8 @@ def __init__( class Disallowed(msrest.serialization.Model): """Describes the disallowed disk types. - :param disk_types: A list of disk types. - :type disk_types: list[str] + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] """ _attribute_map = { @@ -2273,6 +2800,10 @@ def __init__( disk_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ super(Disallowed, self).__init__(**kwargs) self.disk_types = disk_types @@ -2280,9 +2811,9 @@ def __init__( 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", + :ivar vm_disk_type: VM disk types which are disallowed. Possible values include: "None", "Unmanaged". - :type vm_disk_type: str or ~azure.mgmt.compute.v2021_07_01.models.VmDiskTypes + :vartype vm_disk_type: str or ~azure.mgmt.compute.v2021_07_01.models.VmDiskTypes """ _attribute_map = { @@ -2295,6 +2826,11 @@ def __init__( vm_disk_type: Optional[Union[str, "VmDiskTypes"]] = None, **kwargs ): + """ + :keyword vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :paramtype vm_disk_type: str or ~azure.mgmt.compute.v2021_07_01.models.VmDiskTypes + """ super(DisallowedConfiguration, self).__init__(**kwargs) self.vm_disk_type = vm_disk_type @@ -2302,8 +2838,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2316,6 +2852,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -2323,8 +2863,8 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -2337,19 +2877,23 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ 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 + :ivar 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_07_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_07_01.models.KeyVaultKeyReference - :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. - :type enabled: bool + :vartype disk_encryption_key: ~azure.mgmt.compute.v2021_07_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2021_07_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool """ _attribute_map = { @@ -2366,6 +2910,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :paramtype disk_encryption_key: ~azure.mgmt.compute.v2021_07_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2021_07_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ super(DiskEncryptionSettings, self).__init__(**kwargs) self.disk_encryption_key = disk_encryption_key self.key_encryption_key = key_encryption_key @@ -2375,13 +2928,14 @@ def __init__( 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. + :ivar name: The disk name. + :vartype name: str + :ivar 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_07_01.models.DiskEncryptionSettings] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :vartype encryption_settings: + list[~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -2398,6 +2952,16 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(DiskInstanceView, self).__init__(**kwargs) self.name = name self.encryption_settings = encryption_settings @@ -2407,10 +2971,10 @@ def __init__( class EncryptionImages(msrest.serialization.Model): """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. - :param os_disk_image: Contains encryption settings for an OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImageEncryption - :param data_disk_images: A list of encryption specifications for data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.DataDiskImageEncryption] + :ivar os_disk_image: Contains encryption settings for an OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImageEncryption + :ivar data_disk_images: A list of encryption specifications for data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.DataDiskImageEncryption] """ _attribute_map = { @@ -2425,6 +2989,13 @@ def __init__( data_disk_images: Optional[List["DataDiskImageEncryption"]] = None, **kwargs ): + """ + :keyword os_disk_image: Contains encryption settings for an OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImageEncryption + :keyword data_disk_images: A list of encryption specifications for data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2021_07_01.models.DataDiskImageEncryption] + """ super(EncryptionImages, self).__init__(**kwargs) self.os_disk_image = os_disk_image self.data_disk_images = data_disk_images @@ -2433,10 +3004,10 @@ def __init__( 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_07_01.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -2451,6 +3022,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -2469,23 +3046,23 @@ class Gallery(Resource): :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 description: The description of this Shared Image Gallery resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2021_07_01.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile - :param soft_delete_policy: Contains information about the soft deletion policy of the gallery. - :type soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile + :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. + :vartype soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy """ _validation = { @@ -2520,6 +3097,22 @@ def __init__( soft_delete_policy: Optional["SoftDeletePolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile + :keyword soft_delete_policy: Contains information about the soft deletion policy of the + gallery. + :paramtype soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy + """ super(Gallery, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -2541,27 +3134,27 @@ class GalleryApplication(Resource): :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 description: The description of this gallery Application Definition resource. This + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes """ _validation = { @@ -2598,6 +3191,30 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + """ super(GalleryApplication, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -2612,11 +3229,11 @@ class GalleryApplicationList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Gallery Applications. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] - :param next_link: The uri to fetch the next page of Application Definitions in the Application + :ivar value: Required. A list of Gallery Applications. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] + :ivar next_link: The uri to fetch the next page of Application Definitions in the Application Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2635,6 +3252,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Gallery Applications. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] + :keyword next_link: The uri to fetch the next page of Application Definitions in the + Application Gallery. Call ListNext() with this to fetch the next page of gallery Application + Definitions. + :paramtype next_link: str + """ super(GalleryApplicationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2651,8 +3276,8 @@ class UpdateResourceDefinition(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -2674,6 +3299,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(UpdateResourceDefinition, self).__init__(**kwargs) self.id = None self.name = None @@ -2692,25 +3321,25 @@ class GalleryApplicationUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery Application Definition resource. This + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery Application Definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param end_of_life_date: The end of life date of the gallery Application Definition. This + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param supported_os_type: This property allows you to specify the supported type of the OS that + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: This property allows you to specify the supported type of the OS that application is built for. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values include: "Windows", "Linux". - :type supported_os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :vartype supported_os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes """ _validation = { @@ -2744,6 +3373,28 @@ def __init__( supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: This property allows you to specify the supported type of the OS + that application is built for. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + """ super(GalleryApplicationUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -2766,12 +3417,12 @@ class GalleryApplicationVersion(Resource): :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 publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -2809,6 +3460,15 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -2820,11 +3480,11 @@ class GalleryApplicationVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery Application Versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] - :param next_link: The uri to fetch the next page of gallery Application Versions. Call + :ivar value: Required. A list of gallery Application Versions. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] + :ivar next_link: The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery Application Versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -2843,6 +3503,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery Application Versions. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] + :keyword next_link: The uri to fetch the next page of gallery Application Versions. Call + ListNext() with this to fetch the next page of gallery Application Versions. + :paramtype next_link: str + """ super(GalleryApplicationVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2853,28 +3520,28 @@ class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery image version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Possible values include: "Full", "Shallow". - :type replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode + :vartype storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Possible values include: "Full", "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode """ _validation = { @@ -2902,6 +3569,29 @@ def __init__( replication_mode: Optional[Union[str, "ReplicationMode"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Possible values include: "Full", "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode + """ super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) self.target_regions = target_regions self.replica_count = replica_count @@ -2919,34 +3609,34 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil All required parameters must be populated in order to send to Azure. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery image version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Possible values include: "Full", "Shallow". - :type replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode - :param source: Required. The source image from which the Image Version is going to be created. - :type source: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactSource - :param manage_actions: - :type manage_actions: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactManage - :param enable_health_check: Optional. Whether or not this application reports health. - :type enable_health_check: bool + :vartype storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Possible values include: "Full", "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactManage + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool """ _validation = { @@ -2981,6 +3671,36 @@ def __init__( enable_health_check: Optional[bool] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Possible values include: "Full", "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactSource + :keyword manage_actions: + :paramtype manage_actions: ~azure.mgmt.compute.v2021_07_01.models.UserArtifactManage + :keyword enable_health_check: Optional. Whether or not this application reports health. + :paramtype enable_health_check: bool + """ super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, replication_mode=replication_mode, **kwargs) self.source = source self.manage_actions = manage_actions @@ -2998,10 +3718,10 @@ class GalleryApplicationVersionUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". @@ -3036,6 +3756,13 @@ def __init__( publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionPublishingProfile + """ super(GalleryApplicationVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -3047,8 +3774,8 @@ class GalleryArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param managed_image: Required. The managed artifact. - :type managed_image: ~azure.mgmt.compute.v2021_07_01.models.ManagedArtifact + :ivar managed_image: Required. The managed artifact. + :vartype managed_image: ~azure.mgmt.compute.v2021_07_01.models.ManagedArtifact """ _validation = { @@ -3065,6 +3792,10 @@ def __init__( managed_image: "ManagedArtifact", **kwargs ): + """ + :keyword managed_image: Required. The managed artifact. + :paramtype managed_image: ~azure.mgmt.compute.v2021_07_01.models.ManagedArtifact + """ super(GalleryArtifactSource, self).__init__(**kwargs) self.managed_image = managed_image @@ -3072,12 +3803,12 @@ def __init__( class GalleryArtifactVersionSource(msrest.serialization.Model): """The gallery artifact version source. - :param id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, + :ivar id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. - :type id: str - :param uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob + :vartype id: str + :ivar uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob source. - :type uri: str + :vartype uri: str """ _attribute_map = { @@ -3092,6 +3823,14 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword id: The id of the gallery artifact version source. Can specify a disk uri, snapshot + uri, user image or storage account resource. + :paramtype id: str + :keyword uri: The uri of the gallery artifact version source. Currently used to specify + vhd/blob source. + :paramtype uri: str + """ super(GalleryArtifactVersionSource, self).__init__(**kwargs) self.id = id self.uri = uri @@ -3104,11 +3843,11 @@ class GalleryDiskImage(msrest.serialization.Model): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource """ _validation = { @@ -3128,6 +3867,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + """ super(GalleryDiskImage, self).__init__(**kwargs) self.size_in_gb = None self.host_caching = host_caching @@ -3143,15 +3889,15 @@ class GalleryDataDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource - :param lun: Required. This property specifies the logical unit number of the data disk. This + :vartype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + :ivar lun: Required. This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - :type lun: int + :vartype lun: int """ _validation = { @@ -3174,6 +3920,17 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ super(GalleryDataDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) self.lun = lun @@ -3200,6 +3957,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryIdentifier, self).__init__(**kwargs) self.unique_name = None @@ -3217,50 +3976,50 @@ class GalleryImage(Resource): :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 description: The description of this gallery image definition resource. This property is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery image definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery image definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2021_07_01.models.GalleryImagePropertiesProvisioningState - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] """ _validation = { @@ -3313,6 +4072,48 @@ def __init__( features: Optional[List["GalleryImageFeature"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery image definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery image definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + """ super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.eula = eula @@ -3333,10 +4134,10 @@ def __init__( class GalleryImageFeature(msrest.serialization.Model): """A feature for gallery image. - :param name: The name of the gallery image feature. - :type name: str - :param value: The value of the gallery image feature. - :type value: str + :ivar name: The name of the gallery image feature. + :vartype name: str + :ivar value: The value of the gallery image feature. + :vartype value: str """ _attribute_map = { @@ -3351,6 +4152,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the gallery image feature. + :paramtype name: str + :keyword value: The value of the gallery image feature. + :paramtype value: str + """ super(GalleryImageFeature, self).__init__(**kwargs) self.name = name self.value = value @@ -3361,12 +4168,12 @@ class GalleryImageIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param publisher: Required. The name of the gallery image definition publisher. - :type publisher: str - :param offer: Required. The name of the gallery image definition offer. - :type offer: str - :param sku: Required. The name of the gallery image definition SKU. - :type sku: str + :ivar publisher: Required. The name of the gallery image definition publisher. + :vartype publisher: str + :ivar offer: Required. The name of the gallery image definition offer. + :vartype offer: str + :ivar sku: Required. The name of the gallery image definition SKU. + :vartype sku: str """ _validation = { @@ -3389,6 +4196,14 @@ def __init__( sku: str, **kwargs ): + """ + :keyword publisher: Required. The name of the gallery image definition publisher. + :paramtype publisher: str + :keyword offer: Required. The name of the gallery image definition offer. + :paramtype offer: str + :keyword sku: Required. The name of the gallery image definition SKU. + :paramtype sku: str + """ super(GalleryImageIdentifier, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -3400,11 +4215,11 @@ class GalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of Shared Image Gallery images. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] - :param next_link: The uri to fetch the next page of Image Definitions in the Shared Image + :ivar value: Required. A list of Shared Image Gallery images. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] + :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3423,6 +4238,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of Shared Image Gallery images. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] + :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. + :paramtype next_link: str + """ super(GalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3439,48 +4261,48 @@ class GalleryImageUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this gallery image definition resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery image definition resource. This property is updatable. - :type description: str - :param eula: The Eula agreement for the gallery image definition. - :type eula: str - :param privacy_statement_uri: The privacy statement uri. - :type privacy_statement_uri: str - :param release_note_uri: The release note uri. - :type release_note_uri: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :vartype description: str + :ivar eula: The Eula agreement for the gallery image definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2021_07_01.models.GalleryImagePropertiesProvisioningState - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] """ _validation = { @@ -3530,6 +4352,46 @@ def __init__( features: Optional[List["GalleryImageFeature"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery image definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery image definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + """ super(GalleryImageUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.eula = eula @@ -3560,19 +4422,20 @@ class GalleryImageVersion(Resource): :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 publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery image version. :vartype replication_status: ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatus """ @@ -3607,6 +4470,18 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersion, self).__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -3619,11 +4494,11 @@ class GalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of gallery image versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] - :param next_link: The uri to fetch the next page of gallery image versions. Call ListNext() - with this to fetch the next page of gallery image versions. - :type next_link: str + :ivar value: Required. A list of gallery image versions. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] + :ivar next_link: The uri to fetch the next page of gallery image versions. Call ListNext() with + this to fetch the next page of gallery image versions. + :vartype next_link: str """ _validation = { @@ -3642,6 +4517,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of gallery image versions. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] + :keyword next_link: The uri to fetch the next page of gallery image versions. Call ListNext() + with this to fetch the next page of gallery image versions. + :paramtype next_link: str + """ super(GalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3652,28 +4534,28 @@ class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase) Variables are only populated by the server, and will be ignored when sending a request. - :param target_regions: The target regions where the Image Version is going to be replicated to. + :ivar target_regions: The target regions where the Image Version is going to be replicated to. This property is updatable. - :type target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] - :param replica_count: The number of replicas of the Image Version to be created per region. - This property would take effect for a region when regionalReplicaCount is not specified. This + :vartype target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. - :type replica_count: int - :param exclude_from_latest: If set to true, Virtual Machines deployed from the latest version - of the Image Definition won't use this Image Version. - :type exclude_from_latest: bool + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool :ivar published_date: The timestamp for when the gallery image version is published. :vartype published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version. This property can - be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param storage_account_type: Specifies the storage account type to be used to store the image. + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param replication_mode: Optional parameter which specifies the mode to be used for - replication. This property is not updatable. Possible values include: "Full", "Shallow". - :type replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode + :vartype storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Possible values include: "Full", "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode """ _validation = { @@ -3701,18 +4583,41 @@ def __init__( replication_mode: Optional[Union[str, "ReplicationMode"]] = None, **kwargs ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2021_07_01.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Possible values include: "Full", "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationMode + """ super(GalleryImageVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, replication_mode=replication_mode, **kwargs) class GalleryImageVersionStorageProfile(msrest.serialization.Model): """This is the storage profile of a Gallery Image Version. - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.GalleryDataDiskImage] + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.GalleryDataDiskImage] """ _attribute_map = { @@ -3729,6 +4634,14 @@ def __init__( data_disk_images: Optional[List["GalleryDataDiskImage"]] = None, **kwargs ): + """ + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.GalleryDataDiskImage] + """ super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) self.source = source self.os_disk_image = os_disk_image @@ -3746,17 +4659,18 @@ class GalleryImageVersionUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery image Version. - :type publishing_profile: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPropertiesProvisioningState - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile :ivar replication_status: This is the replication status of the gallery image version. :vartype replication_status: ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatus """ @@ -3788,6 +4702,16 @@ def __init__( storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionStorageProfile + """ super(GalleryImageVersionUpdate, self).__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.provisioning_state = None @@ -3800,11 +4724,11 @@ class GalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of galleries. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.Gallery] - :param next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + :ivar value: Required. A list of galleries. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.Gallery] + :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3823,6 +4747,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of galleries. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.Gallery] + :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :paramtype next_link: str + """ super(GalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3835,11 +4766,11 @@ class GalleryOSDiskImage(GalleryDiskImage): :ivar size_in_gb: This property indicates the size of the VHD to be created. :vartype size_in_gb: int - :param host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". - :type host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching - :param source: The gallery artifact version source. - :type source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + :vartype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource """ _validation = { @@ -3859,6 +4790,13 @@ def __init__( source: Optional["GalleryArtifactVersionSource"] = None, **kwargs ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource + """ super(GalleryOSDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) @@ -3873,21 +4811,21 @@ class GalleryUpdate(UpdateResourceDefinition): :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of this Shared Image Gallery resource. This property is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is updatable. - :type description: str - :param identifier: Describes the gallery unique name. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier :ivar provisioning_state: The provisioning state, which only appears in the response. Possible values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.compute.v2021_07_01.models.GalleryPropertiesProvisioningState - :param sharing_profile: Profile for gallery sharing to subscription or tenant. - :type sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile - :param soft_delete_policy: Contains information about the soft deletion policy of the gallery. - :type soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile + :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. + :vartype soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy """ _validation = { @@ -3919,6 +4857,20 @@ def __init__( soft_delete_policy: Optional["SoftDeletePolicy"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2021_07_01.models.SharingProfile + :keyword soft_delete_policy: Contains information about the soft deletion policy of the + gallery. + :paramtype soft_delete_policy: ~azure.mgmt.compute.v2021_07_01.models.SoftDeletePolicy + """ super(GalleryUpdate, self).__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier @@ -3930,7 +4882,7 @@ def __init__( 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 + :ivar 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 @@ -3976,13 +4928,13 @@ class HardwareProfile(msrest.serialization.Model): "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_07_01.models.VirtualMachineSizeTypes - :param vm_size_properties: Specifies the properties for customizing the size of the virtual + :vartype vm_size: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeTypes + :ivar vm_size_properties: Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-07-01. :code:`
    `:code:`
    ` This feature is still in preview mode and is not supported for VirtualMachineScaleSet. :code:`
    `:code:`
    ` Please follow the instructions in `VM Customization `_ for more details. - :type vm_size_properties: ~azure.mgmt.compute.v2021_07_01.models.VMSizeProperties + :vartype vm_size_properties: ~azure.mgmt.compute.v2021_07_01.models.VMSizeProperties """ _attribute_map = { @@ -3997,6 +4949,61 @@ def __init__( vm_size_properties: Optional["VMSizeProperties"] = None, **kwargs ): + """ + :keyword 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". + :paramtype vm_size: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeTypes + :keyword vm_size_properties: Specifies the properties for customizing the size of the virtual + machine. Minimum api-version: 2021-07-01. :code:`
    `:code:`
    ` This feature is still in + preview mode and is not supported for VirtualMachineScaleSet. :code:`
    `:code:`
    ` Please + follow the instructions in `VM Customization `_ for more + details. + :paramtype vm_size_properties: ~azure.mgmt.compute.v2021_07_01.models.VMSizeProperties + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size self.vm_size_properties = vm_size_properties @@ -4015,24 +5022,25 @@ class Image(Resource): :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_07_01.models.ExtendedLocation - :param source_virtual_machine: The source virtual machine from which Image is created. - :type source_virtual_machine: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.ImageStorageProfile + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Image. + :vartype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_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_07_01.models.HyperVGenerationTypes + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationTypes """ _validation = { @@ -4067,6 +5075,25 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Image. + :paramtype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationTypes + """ super(Image, self).__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location self.source_virtual_machine = source_virtual_machine @@ -4078,30 +5105,32 @@ def __init__( class ImageDisk(msrest.serialization.Model): """Describes a image disk. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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_07_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :ivar 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_07_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -4126,6 +5155,34 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + """ super(ImageDisk, self).__init__(**kwargs) self.snapshot = snapshot self.managed_disk = managed_disk @@ -4141,34 +5198,36 @@ class ImageDataDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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_07_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :ivar 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_07_01.models.DiskEncryptionSetParameters - :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + :ivar 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 + :vartype lun: int """ _validation = { @@ -4199,6 +5258,38 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + :keyword 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. + :paramtype lun: int + """ 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 @@ -4208,11 +5299,11 @@ class ImageListResult(msrest.serialization.Model): 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_07_01.models.Image] - :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.Image] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4231,6 +5322,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ super(ImageListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4241,37 +5339,39 @@ class ImageOSDisk(ImageDisk): All required parameters must be populated in order to send to Azure. - :param snapshot: The snapshot. - :type snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param managed_disk: The managedDisk. - :type managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param blob_uri: The Virtual Hard Disk. - :type blob_uri: str - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar 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_07_01.models.CachingTypes - :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar 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_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :ivar 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_07_01.models.DiskEncryptionSetParameters - :param os_type: Required. This property allows you to specify the type of the OS that is + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + :ivar 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_07_01.models.OperatingSystemTypes - :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes """ _validation = { @@ -4305,6 +5405,42 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + """ 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 @@ -4313,12 +5449,12 @@ def __init__( class ImagePurchasePlan(msrest.serialization.Model): """Describes the gallery image definition purchase plan. This is used by marketplace images. - :param name: The plan ID. - :type name: str - :param publisher: The publisher ID. - :type publisher: str - :param product: The product ID. - :type product: str + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str """ _attribute_map = { @@ -4335,6 +5471,14 @@ def __init__( product: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product ID. + :paramtype product: str + """ super(ImagePurchasePlan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4346,28 +5490,28 @@ class ImageReference(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar 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 + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar 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 + :vartype 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 - :param shared_gallery_image_id: Specified the shared gallery image unique id for vm deployment. + :ivar shared_gallery_image_id: Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call. - :type shared_gallery_image_id: str + :vartype shared_gallery_image_id: str """ _validation = { @@ -4395,6 +5539,26 @@ def __init__( shared_gallery_image_id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword 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. + :paramtype version: str + :keyword shared_gallery_image_id: Specified the shared gallery image unique id for vm + deployment. This can be fetched from shared gallery image GET call. + :paramtype shared_gallery_image_id: str + """ super(ImageReference, self).__init__(id=id, **kwargs) self.publisher = publisher self.offer = offer @@ -4407,19 +5571,19 @@ def __init__( class ImageStorageProfile(msrest.serialization.Model): """Describes a storage profile. - :param os_disk: Specifies information about the operating system disk used by the virtual + :ivar 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_07_01.models.ImageOSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2021_07_01.models.ImageOSDisk + :ivar 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_07_01.models.ImageDataDisk] - :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + :vartype data_disks: list[~azure.mgmt.compute.v2021_07_01.models.ImageDataDisk] + :ivar 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 + :vartype zone_resilient: bool """ _attribute_map = { @@ -4436,6 +5600,21 @@ def __init__( zone_resilient: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_07_01.models.ImageOSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2021_07_01.models.ImageDataDisk] + :keyword 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). + :paramtype zone_resilient: bool + """ super(ImageStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -4447,20 +5626,21 @@ class ImageUpdate(UpdateResource): 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_07_01.models.SubResource - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.ImageStorageProfile + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_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_07_01.models.HyperVGenerationTypes + :ivar 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". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationTypes """ _validation = { @@ -4484,6 +5664,21 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.ImageStorageProfile + :keyword 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". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationTypes + """ super(ImageUpdate, self).__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile @@ -4494,10 +5689,10 @@ def __init__( 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 + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str """ _attribute_map = { @@ -4512,6 +5707,12 @@ def __init__( errordetail: Optional[str] = None, **kwargs ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ super(InnerError, self).__init__(**kwargs) self.exceptiontype = exceptiontype self.errordetail = errordetail @@ -4520,16 +5721,16 @@ def __init__( 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_07_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 + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Possible values include: "Info", "Warning", "Error". + :vartype level: str or ~azure.mgmt.compute.v2021_07_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ _attribute_map = { @@ -4550,6 +5751,18 @@ def __init__( time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Possible values include: "Info", "Warning", "Error". + :paramtype level: str or ~azure.mgmt.compute.v2021_07_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ super(InstanceViewStatus, self).__init__(**kwargs) self.code = code self.level = level @@ -4563,10 +5776,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): 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_07_01.models.SubResource + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the key. + :vartype source_vault: ~azure.mgmt.compute.v2021_07_01.models.SubResource """ _validation = { @@ -4586,6 +5799,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the key. + :paramtype source_vault: ~azure.mgmt.compute.v2021_07_01.models.SubResource + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -4596,10 +5815,10 @@ class KeyVaultSecretReference(msrest.serialization.Model): 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_07_01.models.SubResource + :ivar secret_url: Required. The URL referencing a secret in a Key Vault. + :vartype secret_url: str + :ivar source_vault: Required. The relative URL of the Key Vault containing the secret. + :vartype source_vault: ~azure.mgmt.compute.v2021_07_01.models.SubResource """ _validation = { @@ -4619,6 +5838,12 @@ def __init__( source_vault: "SubResource", **kwargs ): + """ + :keyword secret_url: Required. The URL referencing a secret in a Key Vault. + :paramtype secret_url: str + :keyword source_vault: Required. The relative URL of the Key Vault containing the secret. + :paramtype source_vault: ~azure.mgmt.compute.v2021_07_01.models.SubResource + """ super(KeyVaultSecretReference, self).__init__(**kwargs) self.secret_url = secret_url self.source_vault = source_vault @@ -4694,6 +5919,8 @@ def __init__( self, **kwargs ): + """ + """ super(LastPatchInstallationSummary, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -4711,19 +5938,19 @@ def __init__( 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 `_. - :param disable_password_authentication: Specifies whether password authentication should be + :ivar 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_07_01.models.SshConfiguration - :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2021_07_01.models.SshConfiguration + :ivar 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 + :vartype provision_vm_agent: bool + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. - :type patch_settings: ~azure.mgmt.compute.v2021_07_01.models.LinuxPatchSettings + :vartype patch_settings: ~azure.mgmt.compute.v2021_07_01.models.LinuxPatchSettings """ _attribute_map = { @@ -4742,6 +5969,21 @@ def __init__( patch_settings: Optional["LinuxPatchSettings"] = None, **kwargs ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.compute.v2021_07_01.models.SshConfiguration + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :paramtype patch_settings: ~azure.mgmt.compute.v2021_07_01.models.LinuxPatchSettings + """ super(LinuxConfiguration, self).__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh @@ -4752,19 +5994,19 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Linux. - :type classifications_to_include: list[str or + :vartype classifications_to_include: list[str or ~azure.mgmt.compute.v2021_07_01.models.VMGuestPatchClassificationLinux] - :param package_name_masks_to_include: packages to include in the patch operation. Format: + :ivar 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: + :vartype package_name_masks_to_include: list[str] + :ivar 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 + :vartype package_name_masks_to_exclude: list[str] + :ivar maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest Patching in Linux. - :type maintenance_run_id: str + :vartype maintenance_run_id: str """ _attribute_map = { @@ -4783,6 +6025,21 @@ def __init__( maintenance_run_id: Optional[str] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Linux. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_07_01.models.VMGuestPatchClassificationLinux] + :keyword package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_include: list[str] + :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_exclude: list[str] + :keyword maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :paramtype maintenance_run_id: str + """ super(LinuxParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.package_name_masks_to_include = package_name_masks_to_include @@ -4793,21 +6050,22 @@ def __init__( 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 or virtual + :ivar patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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_07_01.models.LinuxVMGuestPatchMode - :param assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + :vartype patch_mode: str or ~azure.mgmt.compute.v2021_07_01.models.LinuxVMGuestPatchMode + :ivar assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. Possible values include: "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_07_01.models.LinuxPatchAssessmentMode + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2021_07_01.models.LinuxPatchAssessmentMode """ _attribute_map = { @@ -4822,6 +6080,24 @@ def __init__( assessment_mode: Optional[Union[str, "LinuxPatchAssessmentMode"]] = None, **kwargs ): + """ + :keyword patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2021_07_01.models.LinuxVMGuestPatchMode + :keyword assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` + **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2021_07_01.models.LinuxPatchAssessmentMode + """ super(LinuxPatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode self.assessment_mode = assessment_mode @@ -4832,11 +6108,11 @@ class ListUsagesResult(msrest.serialization.Model): 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_07_01.models.Usage] - :param next_link: The URI to fetch the next page of compute resource usage information. Call + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.Usage] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -4855,6 +6131,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.Usage] + :keyword 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. + :paramtype next_link: str + """ super(ListUsagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4865,23 +6148,23 @@ class LogAnalyticsInputBase(msrest.serialization.Model): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -4914,6 +6197,25 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ super(LogAnalyticsInputBase, self).__init__(**kwargs) self.blob_container_sas_uri = blob_container_sas_uri self.from_time = from_time @@ -4946,6 +6248,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -4971,6 +6275,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -4978,23 +6284,23 @@ def __init__( class MaintenanceRedeployStatus(msrest.serialization.Model): """Maintenance Operation Status. - :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + :ivar 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 + :vartype is_customer_initiated_maintenance_allowed: bool + :ivar pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_start_time: ~datetime.datetime + :ivar pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :vartype pre_maintenance_window_end_time: ~datetime.datetime + :ivar maintenance_window_start_time: Start Time for the Maintenance Window. + :vartype maintenance_window_start_time: ~datetime.datetime + :ivar maintenance_window_end_time: End Time for the Maintenance Window. + :vartype maintenance_window_end_time: ~datetime.datetime + :ivar last_operation_result_code: The Last Maintenance Operation Result Code. Possible values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". - :type last_operation_result_code: str or + :vartype last_operation_result_code: str or ~azure.mgmt.compute.v2021_07_01.models.MaintenanceOperationResultCodeTypes - :param last_operation_message: Message returned for the last Maintenance Operation. - :type last_operation_message: str + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str """ _attribute_map = { @@ -5019,6 +6325,25 @@ def __init__( last_operation_message: Optional[str] = None, **kwargs ): + """ + :keyword is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :paramtype is_customer_initiated_maintenance_allowed: bool + :keyword pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_start_time: ~datetime.datetime + :keyword pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :paramtype pre_maintenance_window_end_time: ~datetime.datetime + :keyword maintenance_window_start_time: Start Time for the Maintenance Window. + :paramtype maintenance_window_start_time: ~datetime.datetime + :keyword maintenance_window_end_time: End Time for the Maintenance Window. + :paramtype maintenance_window_end_time: ~datetime.datetime + :keyword last_operation_result_code: The Last Maintenance Operation Result Code. Possible + values include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :paramtype last_operation_result_code: str or + ~azure.mgmt.compute.v2021_07_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ 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 @@ -5034,8 +6359,8 @@ class ManagedArtifact(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The managed artifact id. - :type id: str + :ivar id: Required. The managed artifact id. + :vartype id: str """ _validation = { @@ -5052,6 +6377,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ super(ManagedArtifact, self).__init__(**kwargs) self.id = id @@ -5059,16 +6388,18 @@ def __init__( 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: + :ivar id: Resource Id. + :vartype id: str + :ivar 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_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -5085,6 +6416,20 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + """ super(ManagedDiskParameters, self).__init__(id=id, **kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -5093,14 +6438,14 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions """ _attribute_map = { @@ -5117,6 +6462,16 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + """ super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) self.primary = primary self.delete_option = delete_option @@ -5125,17 +6480,17 @@ def __init__( class NetworkProfile(msrest.serialization.Model): """Specifies the network interfaces or the networking configuration of the virtual machine. - :param network_interfaces: Specifies the list of resource Ids for the network interfaces + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - :type network_interfaces: + :vartype network_interfaces: list[~azure.mgmt.compute.v2021_07_01.models.NetworkInterfaceReference] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion - :param network_interface_configurations: Specifies the networking configurations that will be + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion + :ivar network_interface_configurations: Specifies the networking configurations that will be used to create the virtual machine networking resources. - :type network_interface_configurations: + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceConfiguration] """ @@ -5153,6 +6508,20 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineNetworkInterfaceConfiguration"]] = None, **kwargs ): + """ + :keyword network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.compute.v2021_07_01.models.NetworkInterfaceReference] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations. Possible values include: + "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion + :keyword network_interface_configurations: Specifies the networking configurations that will be + used to create the virtual machine networking resources. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceConfiguration] + """ super(NetworkProfile, self).__init__(**kwargs) self.network_interfaces = network_interfaces self.network_api_version = network_api_version @@ -5164,12 +6533,12 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_name: Required. The name of the service. Possible values include: + :ivar service_name: Required. The name of the service. Possible values include: "AutomaticRepairs", "DummyOrchestrationServiceName". - :type service_name: str or ~azure.mgmt.compute.v2021_07_01.models.OrchestrationServiceNames - :param action: Required. The action to be performed. Possible values include: "Resume", + :vartype service_name: str or ~azure.mgmt.compute.v2021_07_01.models.OrchestrationServiceNames + :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". - :type action: str or ~azure.mgmt.compute.v2021_07_01.models.OrchestrationServiceStateAction + :vartype action: str or ~azure.mgmt.compute.v2021_07_01.models.OrchestrationServiceStateAction """ _validation = { @@ -5189,6 +6558,16 @@ def __init__( action: Union[str, "OrchestrationServiceStateAction"], **kwargs ): + """ + :keyword service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :paramtype service_name: str or + ~azure.mgmt.compute.v2021_07_01.models.OrchestrationServiceNames + :keyword action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :paramtype action: str or + ~azure.mgmt.compute.v2021_07_01.models.OrchestrationServiceStateAction + """ super(OrchestrationServiceStateInput, self).__init__(**kwargs) self.service_name = service_name self.action = action @@ -5221,6 +6600,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrchestrationServiceSummary, self).__init__(**kwargs) self.service_name = None self.service_state = None @@ -5231,56 +6612,56 @@ class OSDisk(msrest.serialization.Model): 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 + :ivar 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_07_01.models.OperatingSystemTypes - :param encryption_settings: Specifies the encryption settings for the OS Disk. + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar 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_07_01.models.DiskEncryptionSettings - :param name: The disk name. - :type name: str - :param vhd: The virtual hard disk. - :type vhd: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk - :param image: The source user image virtual hard disk. The virtual hard disk will be copied + :vartype encryption_settings: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :ivar 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_07_01.models.VirtualHardDisk - :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + :vartype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :ivar 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_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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_07_01.models.DiffDiskSettings - :param create_option: Required. Specifies how the virtual machine should be + :vartype diff_disk_settings: ~azure.mgmt.compute.v2021_07_01.models.DiffDiskSettings + :ivar 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_07_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :ivar 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_07_01.models.ManagedDiskParameters - :param delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The default value is set to **detach**. For an ephemeral OS Disk, the default value is set to **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes """ _validation = { @@ -5319,6 +6700,58 @@ def __init__( delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2021_07_01.models.DiffDiskSettings + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :keyword delete_option: Specifies whether OS Disk should be deleted or detached upon VM + deletion. :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the OS disk is deleted when VM is deleted.:code:`
    `:code:`
    ` **Detach** If + this value is used, the os disk is retained after VM is deleted. :code:`
    `:code:`
    ` The + default value is set to **detach**. For an ephemeral OS Disk, the default value is set to + **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values + include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskDeleteOptionTypes + """ super(OSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -5339,9 +6772,9 @@ class OSDiskImage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operating_system: Required. The operating system of the osDiskImage. Possible values + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values include: "Windows", "Linux". - :type operating_system: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :vartype operating_system: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes """ _validation = { @@ -5358,6 +6791,11 @@ def __init__( operating_system: Union[str, "OperatingSystemTypes"], **kwargs ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + """ super(OSDiskImage, self).__init__(**kwargs) self.operating_system = operating_system @@ -5365,9 +6803,9 @@ def __init__( class OSDiskImageEncryption(DiskImageEncryption): """Contains encryption settings for an OS disk image. - :param disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption set. - :type disk_encryption_set_id: str + :vartype disk_encryption_set_id: str """ _attribute_map = { @@ -5380,31 +6818,35 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ super(OSDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) 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. + :ivar 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. - :type admin_username: str - :param admin_password: Specifies the password of the administrator account. + :vartype computer_name: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -5418,8 +6860,8 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 @@ -5429,30 +6871,30 @@ class OSProfile(msrest.serialization.Model): :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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration + :ivar 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 `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machine. To install certificates on a virtual machine it is recommended to use the `Azure Key - Vault virtual machine extension for Linux + :vartype linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + To install certificates on a virtual machine it is recommended to use the `Azure Key Vault + virtual machine extension for Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] - :param allow_extension_operations: Specifies whether extension operations should be allowed on + :vartype secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] + :ivar 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 + :vartype allow_extension_operations: bool + :ivar 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 + :vartype require_guest_provision_signal: bool """ _attribute_map = { @@ -5481,6 +6923,75 @@ def __init__( require_guest_provision_signal: Optional[bool] = None, **kwargs ): + """ + :keyword 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 + `_. + :paramtype computer_name: str + :keyword 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. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. To install certificates on a virtual machine it is recommended to use the `Azure Key + Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] + :keyword 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. + :paramtype allow_extension_operations: bool + :keyword 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.**. + :paramtype require_guest_provision_signal: bool + """ super(OSProfile, self).__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username @@ -5538,6 +7049,8 @@ def __init__( self, **kwargs ): + """ + """ super(PatchInstallationDetail, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -5550,7 +7063,7 @@ def __init__( 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 or virtual + :ivar patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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 @@ -5561,18 +7074,19 @@ class PatchSettings(msrest.serialization.Model): **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_07_01.models.WindowsVMGuestPatchMode - :param enable_hotpatching: Enables customers to patch their Azure VMs without requiring a + :vartype patch_mode: str or ~azure.mgmt.compute.v2021_07_01.models.WindowsVMGuestPatchMode + :ivar 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 - :param assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual + :vartype enable_hotpatching: bool + :ivar assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. Possible values include: "ImageDefault", "AutomaticByPlatform". - :type assessment_mode: str or ~azure.mgmt.compute.v2021_07_01.models.WindowsPatchAssessmentMode + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2021_07_01.models.WindowsPatchAssessmentMode """ _attribute_map = { @@ -5589,6 +7103,32 @@ def __init__( assessment_mode: Optional[Union[str, "WindowsPatchAssessmentMode"]] = None, **kwargs ): + """ + :keyword patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + machines associated to virtual machine scale set with OrchestrationMode as Flexible.: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". + :paramtype patch_mode: str or ~azure.mgmt.compute.v2021_07_01.models.WindowsVMGuestPatchMode + :keyword 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'. + :paramtype enable_hotpatching: bool + :keyword assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual + machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` + **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
    `:code:`
    ` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2021_07_01.models.WindowsPatchAssessmentMode + """ super(PatchSettings, self).__init__(**kwargs) self.patch_mode = patch_mode self.enable_hotpatching = enable_hotpatching @@ -5620,6 +7160,8 @@ def __init__( self, **kwargs ): + """ + """ super(PirResource, self).__init__(**kwargs) self.name = None self.location = None @@ -5634,8 +7176,8 @@ class PirSharedGalleryResource(PirResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str """ _validation = { @@ -5655,6 +7197,10 @@ def __init__( unique_id: Optional[str] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ super(PirSharedGalleryResource, self).__init__(**kwargs) self.unique_id = unique_id @@ -5662,15 +7208,15 @@ def __init__( 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 + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar 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 + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str """ _attribute_map = { @@ -5689,6 +7235,17 @@ def __init__( promotion_code: Optional[str] = None, **kwargs ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -5709,15 +7266,15 @@ class ProximityPlacementGroup(Resource): :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. + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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 + :vartype proximity_placement_group_type: str or ~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroupType :ivar virtual_machines: A list of references to all virtual machines in the proximity placement group. @@ -5731,8 +7288,8 @@ class ProximityPlacementGroup(Resource): placement group. :vartype availability_sets: list[~azure.mgmt.compute.v2021_07_01.models.SubResourceWithColocationStatus] - :param colocation_status: Describes colocation status of the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus """ _validation = { @@ -5767,6 +7324,20 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus + """ super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type self.virtual_machines = None @@ -5780,10 +7351,10 @@ class ProximityPlacementGroupListResult(msrest.serialization.Model): 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_07_01.models.ProximityPlacementGroup] - :param next_link: The URI to fetch the next page of proximity placement groups. - :type next_link: str + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str """ _validation = { @@ -5802,6 +7373,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ super(ProximityPlacementGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5810,8 +7387,8 @@ def __init__( class ProximityPlacementGroupUpdate(UpdateResource): """Specifies information about the proximity placement group. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -5824,6 +7401,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) @@ -5856,6 +7437,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -5865,10 +7448,10 @@ def __init__( class PublicIPAddressSku(msrest.serialization.Model): """Describes the public IP Sku. - :param name: Specify public IP sku name. Possible values include: "Basic", "Standard". - :type name: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuName - :param tier: Specify public IP sku tier. Possible values include: "Regional", "Global". - :type tier: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuTier + :ivar name: Specify public IP sku name. Possible values include: "Basic", "Standard". + :vartype name: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuName + :ivar tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :vartype tier: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuTier """ _attribute_map = { @@ -5883,6 +7466,12 @@ def __init__( tier: Optional[Union[str, "PublicIPAddressSkuTier"]] = None, **kwargs ): + """ + :keyword name: Specify public IP sku name. Possible values include: "Basic", "Standard". + :paramtype name: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuName + :keyword tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :paramtype tier: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSkuTier + """ super(PublicIPAddressSku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5893,13 +7482,13 @@ class PurchasePlan(msrest.serialization.Model): 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 + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar name: Required. The plan ID. + :vartype name: str + :ivar 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 + :vartype product: str """ _validation = { @@ -5922,6 +7511,15 @@ def __init__( product: str, **kwargs ): + """ + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + """ super(PurchasePlan, self).__init__(**kwargs) self.publisher = publisher self.name = name @@ -5931,10 +7529,10 @@ def __init__( class RecommendedMachineConfiguration(msrest.serialization.Model): """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. - :param v_cp_us: Describes the resource range. - :type v_cp_us: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange - :param memory: Describes the resource range. - :type memory: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange """ _attribute_map = { @@ -5949,6 +7547,12 @@ def __init__( memory: Optional["ResourceRange"] = None, **kwargs ): + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2021_07_01.models.ResourceRange + """ super(RecommendedMachineConfiguration, self).__init__(**kwargs) self.v_cp_us = v_cp_us self.memory = memory @@ -5980,6 +7584,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -6019,6 +7625,8 @@ def __init__( self, **kwargs ): + """ + """ super(RegionalReplicationStatus, self).__init__(**kwargs) self.region = None self.state = None @@ -6054,6 +7662,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = None @@ -6064,26 +7674,26 @@ class RequestRateByIntervalInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool + :ivar 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_07_01.models.IntervalInMins + :vartype interval_length: str or ~azure.mgmt.compute.v2021_07_01.models.IntervalInMins """ _validation = { @@ -6119,6 +7729,28 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + :keyword interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :paramtype interval_length: str or ~azure.mgmt.compute.v2021_07_01.models.IntervalInMins + """ 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 @@ -6126,10 +7758,10 @@ def __init__( class ResourceRange(msrest.serialization.Model): """Describes the resource range. - :param min: The minimum number of the resource. - :type min: int - :param max: The maximum number of the resource. - :type max: int + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int """ _attribute_map = { @@ -6144,6 +7776,12 @@ def __init__( max: Optional[int] = None, **kwargs ): + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ super(ResourceRange, self).__init__(**kwargs) self.min = min self.max = max @@ -6222,6 +7860,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -6263,6 +7903,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = None self.value = None @@ -6302,6 +7944,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -6338,6 +7982,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCosts, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -6381,6 +8027,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -6414,6 +8062,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -6455,6 +8105,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = None self.values = None @@ -6467,11 +8119,11 @@ class ResourceSkusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSku] - :param next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this - URI to fetch the next page of Resource Skus. - :type next_link: str + :ivar value: Required. The list of skus available for the subscription. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSku] + :ivar next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI + to fetch the next page of Resource Skus. + :vartype next_link: str """ _validation = { @@ -6490,6 +8142,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the subscription. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSku] + :keyword next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this + URI to fetch the next page of Resource Skus. + :paramtype next_link: str + """ super(ResourceSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6521,6 +8180,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = None self.capabilities = None @@ -6537,9 +8198,9 @@ class RestorePoint(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param exclude_disks: List of disk resource ids that the customer wishes to exclude from the + :ivar exclude_disks: List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. - :type exclude_disks: list[~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference] + :vartype exclude_disks: list[~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference] :ivar source_metadata: Gets the details of the VM captured at the time of the restore point creation. :vartype source_metadata: ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceMetadata @@ -6549,10 +8210,8 @@ class RestorePoint(ProxyResource): https://aka.ms/RestorePoints for more details. Possible values include: "CrashConsistent", "FileSystemConsistent", "ApplicationConsistent". :vartype consistency_mode: str or ~azure.mgmt.compute.v2021_07_01.models.ConsistencyModeTypes - :ivar provisioning_details: Gets the provisioning details set by the server during Create - restore point operation. - :vartype provisioning_details: - ~azure.mgmt.compute.v2021_07_01.models.RestorePointProvisioningDetails + :ivar time_created: Gets the creation time of the restore point. + :vartype time_created: ~datetime.datetime """ _validation = { @@ -6562,7 +8221,6 @@ class RestorePoint(ProxyResource): 'source_metadata': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'consistency_mode': {'readonly': True}, - 'provisioning_details': {'readonly': True}, } _attribute_map = { @@ -6573,21 +8231,29 @@ class RestorePoint(ProxyResource): 'source_metadata': {'key': 'properties.sourceMetadata', 'type': 'RestorePointSourceMetadata'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'consistency_mode': {'key': 'properties.consistencyMode', 'type': 'str'}, - 'provisioning_details': {'key': 'properties.provisioningDetails', 'type': 'RestorePointProvisioningDetails'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, } def __init__( self, *, exclude_disks: Optional[List["ApiEntityReference"]] = None, + time_created: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword exclude_disks: List of disk resource ids that the customer wishes to exclude from the + restore point. If no disks are specified, all disks will be included. + :paramtype exclude_disks: list[~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference] + :keyword time_created: Gets the creation time of the restore point. + :paramtype time_created: ~datetime.datetime + """ super(RestorePoint, self).__init__(**kwargs) self.exclude_disks = exclude_disks self.source_metadata = None self.provisioning_state = None self.consistency_mode = None - self.provisioning_details = None + self.time_created = time_created class RestorePointCollection(Resource): @@ -6603,13 +8269,13 @@ class RestorePointCollection(Resource): :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 properties of the source resource that this restore point collection is + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The properties of the source resource that this restore point collection is created from. - :type source: ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties :ivar provisioning_state: The provisioning state of the restore point collection. :vartype provisioning_state: str :ivar restore_point_collection_id: The unique id of the restore point collection. @@ -6649,6 +8315,16 @@ def __init__( source: Optional["RestorePointCollectionSourceProperties"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The properties of the source resource that this restore point collection is + created from. + :paramtype source: + ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties + """ super(RestorePointCollection, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.provisioning_state = None @@ -6659,11 +8335,11 @@ def __init__( class RestorePointCollectionListResult(msrest.serialization.Model): """The List restore point collection operation response. - :param value: Gets the list of restore point collections. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollection] - :param next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + :ivar value: Gets the list of restore point collections. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollection] + :ivar next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() with this to fetch the next page of RestorePointCollections. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -6678,6 +8354,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets the list of restore point collections. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollection] + :keyword next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + with this to fetch the next page of RestorePointCollections. + :paramtype next_link: str + """ super(RestorePointCollectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6690,8 +8373,8 @@ class RestorePointCollectionSourceProperties(msrest.serialization.Model): :ivar location: Location of the source resource used to create this restore point collection. :vartype location: str - :param id: Resource Id of the source resource used to create this restore point collection. - :type id: str + :ivar id: Resource Id of the source resource used to create this restore point collection. + :vartype id: str """ _validation = { @@ -6709,6 +8392,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id of the source resource used to create this restore point collection. + :paramtype id: str + """ super(RestorePointCollectionSourceProperties, self).__init__(**kwargs) self.location = None self.id = id @@ -6719,11 +8406,11 @@ class RestorePointCollectionUpdate(UpdateResource): 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 properties of the source resource that this restore point collection is + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The properties of the source resource that this restore point collection is created from. - :type source: ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties :ivar provisioning_state: The provisioning state of the restore point collection. :vartype provisioning_state: str :ivar restore_point_collection_id: The unique id of the restore point collection. @@ -6754,6 +8441,14 @@ def __init__( source: Optional["RestorePointCollectionSourceProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The properties of the source resource that this restore point collection is + created from. + :paramtype source: + ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionSourceProperties + """ super(RestorePointCollectionUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.provisioning_state = None @@ -6761,63 +8456,26 @@ def __init__( self.restore_points = None -class RestorePointProvisioningDetails(msrest.serialization.Model): - """Restore Point Provisioning details. - - :param creation_time: Gets the creation time of the restore point. - :type creation_time: ~datetime.datetime - :param total_used_size_in_bytes: Gets the total size of the data in all the disks which are - part of the restore point. - :type total_used_size_in_bytes: long - :param status_code: Gets the status of the Create restore point operation. - :type status_code: int - :param status_message: Gets the status message of the Create restore point operation. - :type status_message: str - """ - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'total_used_size_in_bytes': {'key': 'totalUsedSizeInBytes', 'type': 'long'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - } - - def __init__( - self, - *, - creation_time: Optional[datetime.datetime] = None, - total_used_size_in_bytes: Optional[int] = None, - status_code: Optional[int] = None, - status_message: Optional[str] = None, - **kwargs - ): - super(RestorePointProvisioningDetails, self).__init__(**kwargs) - self.creation_time = creation_time - self.total_used_size_in_bytes = total_used_size_in_bytes - self.status_code = status_code - self.status_message = status_message - - class RestorePointSourceMetadata(msrest.serialization.Model): """Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point creation. - :param hardware_profile: Gets the hardware profile. - :type hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile - :param storage_profile: Gets the storage profile. - :type storage_profile: + :ivar hardware_profile: Gets the hardware profile. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :ivar storage_profile: Gets the storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMStorageProfile - :param os_profile: Gets the OS profile. - :type os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile - :param diagnostics_profile: Gets the diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param license_type: Gets the license type, which is for bring your own license scenario. - :type license_type: str - :param vm_id: Gets the virtual machine unique id. - :type vm_id: str - :param security_profile: Gets the security profile. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param location: Location of the VM from which the restore point was created. - :type location: str + :ivar os_profile: Gets the OS profile. + :vartype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :ivar diagnostics_profile: Gets the diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :ivar license_type: Gets the license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar vm_id: Gets the virtual machine unique id. + :vartype vm_id: str + :ivar security_profile: Gets the security profile. + :vartype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :ivar location: Location of the VM from which the restore point was created. + :vartype location: str """ _attribute_map = { @@ -6844,6 +8502,25 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword hardware_profile: Gets the hardware profile. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :keyword storage_profile: Gets the storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMStorageProfile + :keyword os_profile: Gets the OS profile. + :paramtype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :keyword diagnostics_profile: Gets the diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :keyword license_type: Gets the license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword vm_id: Gets the virtual machine unique id. + :paramtype vm_id: str + :keyword security_profile: Gets the security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :keyword location: Location of the VM from which the restore point was created. + :paramtype location: str + """ super(RestorePointSourceMetadata, self).__init__(**kwargs) self.hardware_profile = hardware_profile self.storage_profile = storage_profile @@ -6858,20 +8535,19 @@ def __init__( class RestorePointSourceVMDataDisk(msrest.serialization.Model): """Describes a data disk. - :param lun: Gets the logical unit number. - :type lun: int - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes - :param disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired + :ivar lun: Gets the logical unit number. + :vartype lun: int + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference """ _attribute_map = { @@ -6894,6 +8570,22 @@ def __init__( disk_restore_point: Optional["ApiEntityReference"] = None, **kwargs ): + """ + :keyword lun: Gets the logical unit number. + :paramtype lun: int + :keyword name: Gets the disk name. + :paramtype name: str + :keyword caching: Gets the caching type. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new + desired size for existing OS and Data disks. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + """ super(RestorePointSourceVMDataDisk, self).__init__(**kwargs) self.lun = lun self.name = name @@ -6906,21 +8598,20 @@ def __init__( class RestorePointSourceVMOSDisk(msrest.serialization.Model): """Describes an Operating System disk. - :param os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemType - :param encryption_settings: Gets the disk encryption settings. - :type encryption_settings: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings - :param name: Gets the disk name. - :type name: str - :param caching: Gets the caching type. Possible values include: "None", "ReadOnly", - "ReadWrite". - :type caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes - :param disk_size_gb: Gets the disk size in GB. - :type disk_size_gb: int - :param managed_disk: Gets the managed disk details. - :type managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters - :param disk_restore_point: Gets the disk restore point Id. - :type disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :ivar os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemType + :ivar encryption_settings: Gets the disk encryption settings. + :vartype encryption_settings: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar disk_size_gb: Gets the disk size in GB. + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference """ _attribute_map = { @@ -6945,6 +8636,23 @@ def __init__( disk_restore_point: Optional["ApiEntityReference"] = None, **kwargs ): + """ + :keyword os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemType + :keyword encryption_settings: Gets the disk encryption settings. + :paramtype encryption_settings: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSettings + :keyword name: Gets the disk name. + :paramtype name: str + :keyword caching: Gets the caching type. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword disk_size_gb: Gets the disk size in GB. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + """ super(RestorePointSourceVMOSDisk, self).__init__(**kwargs) self.os_type = os_type self.encryption_settings = encryption_settings @@ -6958,11 +8666,11 @@ def __init__( class RestorePointSourceVMStorageProfile(msrest.serialization.Model): """Describes the storage profile. - :param os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. - :type os_disk: ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMOSDisk - :param data_disks: Gets the data disks of the VM captured at the time of the restore point + :ivar os_disk: Gets the OS disk of the VM captured at the time of the restore point creation. + :vartype os_disk: ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMOSDisk + :ivar data_disks: Gets the data disks of the VM captured at the time of the restore point creation. - :type data_disks: list[~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMDataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMDataDisk] """ _attribute_map = { @@ -6977,6 +8685,15 @@ def __init__( data_disks: Optional[List["RestorePointSourceVMDataDisk"]] = None, **kwargs ): + """ + :keyword os_disk: Gets the OS disk of the VM captured at the time of the restore point + creation. + :paramtype os_disk: ~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMOSDisk + :keyword data_disks: Gets the data disks of the VM captured at the time of the restore point + creation. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_07_01.models.RestorePointSourceVMDataDisk] + """ super(RestorePointSourceVMStorageProfile, self).__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks @@ -7007,6 +8724,8 @@ def __init__( self, **kwargs ): + """ + """ super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -7042,6 +8761,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -7051,33 +8772,33 @@ def __init__( 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 + :ivar 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 + :vartype max_batch_instance_percent: int + :ivar 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 + :vartype max_unhealthy_instance_percent: int + :ivar 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 + :vartype max_unhealthy_upgraded_instance_percent: int + :ivar 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 + :vartype pause_time_between_batches: str + :ivar 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 + :vartype enable_cross_zone_upgrade: bool + :ivar prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before any + healthy instances. + :vartype prioritize_unhealthy_instances: bool """ _validation = { @@ -7106,6 +8827,35 @@ def __init__( prioritize_unhealthy_instances: Optional[bool] = None, **kwargs ): + """ + :keyword 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%. + :paramtype max_batch_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_instance_percent: int + :keyword 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%. + :paramtype max_unhealthy_upgraded_instance_percent: int + :keyword 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). + :paramtype pause_time_between_batches: str + :keyword 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. + :paramtype enable_cross_zone_upgrade: bool + :keyword prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before + any healthy instances. + :paramtype prioritize_unhealthy_instances: bool + """ super(RollingUpgradePolicy, self).__init__(**kwargs) self.max_batch_instance_percent = max_batch_instance_percent self.max_unhealthy_instance_percent = max_unhealthy_instance_percent @@ -7149,6 +8899,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -7191,6 +8943,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -7211,10 +8965,10 @@ class RollingUpgradeStatusInfo(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2021_07_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -7256,6 +9010,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) self.policy = None self.running_status = None @@ -7268,17 +9028,17 @@ class RunCommandDocumentBase(msrest.serialization.Model): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_07_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 + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str """ _validation = { @@ -7307,6 +9067,19 @@ def __init__( description: str, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ super(RunCommandDocumentBase, self).__init__(**kwargs) self.schema = schema self.id = id @@ -7320,21 +9093,21 @@ class RunCommandDocument(RunCommandDocumentBase): 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", + :ivar schema: Required. The VM run command schema. + :vartype schema: str + :ivar id: Required. The VM run command id. + :vartype id: str + :ivar os_type: Required. The Operating System type. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.compute.v2021_07_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_07_01.models.RunCommandParameterDefinition] + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandParameterDefinition] """ _validation = { @@ -7368,6 +9141,24 @@ def __init__( parameters: Optional[List["RunCommandParameterDefinition"]] = None, **kwargs ): + """ + :keyword schema: Required. The VM run command schema. + :paramtype schema: str + :keyword id: Required. The VM run command id. + :paramtype id: str + :keyword os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2021_07_01.models.RunCommandParameterDefinition] + """ super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) self.script = script self.parameters = parameters @@ -7378,13 +9169,13 @@ class RunCommandInput(msrest.serialization.Model): 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 + :ivar command_id: Required. The run command id. + :vartype command_id: str + :ivar 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_07_01.models.RunCommandInputParameter] + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] """ _validation = { @@ -7405,6 +9196,15 @@ def __init__( parameters: Optional[List["RunCommandInputParameter"]] = None, **kwargs ): + """ + :keyword command_id: Required. The run command id. + :paramtype command_id: str + :keyword script: Optional. The script to be executed. When this value is given, the given + script will override the default script of the command. + :paramtype script: list[str] + :keyword parameters: The run command parameters. + :paramtype parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] + """ super(RunCommandInput, self).__init__(**kwargs) self.command_id = command_id self.script = script @@ -7416,10 +9216,10 @@ class RunCommandInputParameter(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str """ _validation = { @@ -7439,6 +9239,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword value: Required. The run command parameter value. + :paramtype value: str + """ super(RunCommandInputParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -7449,11 +9255,11 @@ class RunCommandListResult(msrest.serialization.Model): 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_07_01.models.RunCommandDocumentBase] - :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandDocumentBase] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -7472,6 +9278,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ super(RunCommandListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7482,14 +9295,14 @@ class RunCommandParameterDefinition(msrest.serialization.Model): 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 + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar type: Required. The run command parameter type. + :vartype type: str + :ivar default_value: The run command parameter default value. + :vartype default_value: str + :ivar required: The run command parameter required. + :vartype required: bool """ _validation = { @@ -7513,6 +9326,16 @@ def __init__( required: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The run command parameter name. + :paramtype name: str + :keyword type: Required. The run command parameter type. + :paramtype type: str + :keyword default_value: The run command parameter default value. + :paramtype default_value: str + :keyword required: The run command parameter required. + :paramtype required: bool + """ super(RunCommandParameterDefinition, self).__init__(**kwargs) self.name = name self.type = type @@ -7523,8 +9346,8 @@ def __init__( class RunCommandResult(msrest.serialization.Model): """RunCommandResult. - :param value: Run command operation response. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -7537,6 +9360,10 @@ def __init__( value: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(RunCommandResult, self).__init__(**kwargs) self.value = value @@ -7544,7 +9371,7 @@ def __init__( 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. + :ivar 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 @@ -7558,12 +9385,12 @@ class ScaleInPolicy(msrest.serialization.Model): 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 + :vartype rules: list[str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetScaleInRules] - :param force_deletion: This property allows you to specify if virtual machines chosen for + :ivar force_deletion: This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature in Preview). - :type force_deletion: bool + :vartype force_deletion: bool """ _attribute_map = { @@ -7578,6 +9405,28 @@ def __init__( force_deletion: Optional[bool] = None, **kwargs ): + """ + :keyword 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:`
    `. + :paramtype rules: list[str or + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetScaleInRules] + :keyword force_deletion: This property allows you to specify if virtual machines chosen for + removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature + in Preview). + :paramtype force_deletion: bool + """ super(ScaleInPolicy, self).__init__(**kwargs) self.rules = rules self.force_deletion = force_deletion @@ -7586,9 +9435,9 @@ def __init__( class ScheduledEventsProfile(msrest.serialization.Model): """ScheduledEventsProfile. - :param terminate_notification_profile: Specifies Terminate Scheduled Event related + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related configurations. - :type terminate_notification_profile: + :vartype terminate_notification_profile: ~azure.mgmt.compute.v2021_07_01.models.TerminateNotificationProfile """ @@ -7602,6 +9451,12 @@ def __init__( terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, **kwargs ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2021_07_01.models.TerminateNotificationProfile + """ super(ScheduledEventsProfile, self).__init__(**kwargs) self.terminate_notification_profile = terminate_notification_profile @@ -7609,20 +9464,20 @@ def __init__( class SecurityProfile(msrest.serialization.Model): """Specifies the Security profile settings for the virtual machine or virtual machine scale set. - :param uefi_settings: Specifies the security settings like secure boot and vTPM used while + :ivar 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_07_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. + :vartype uefi_settings: ~azure.mgmt.compute.v2021_07_01.models.UefiSettings + :ivar 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 - :param security_type: Specifies the SecurityType of the virtual machine. It is set as + :vartype 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. Possible values include: "TrustedLaunch". - :type security_type: str or ~azure.mgmt.compute.v2021_07_01.models.SecurityTypes + :vartype security_type: str or ~azure.mgmt.compute.v2021_07_01.models.SecurityTypes """ _attribute_map = { @@ -7639,6 +9494,22 @@ def __init__( security_type: Optional[Union[str, "SecurityTypes"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype uefi_settings: ~azure.mgmt.compute.v2021_07_01.models.UefiSettings + :keyword 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. + :paramtype encryption_at_host: bool + :keyword 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. Possible values include: + "TrustedLaunch". + :paramtype security_type: str or ~azure.mgmt.compute.v2021_07_01.models.SecurityTypes + """ super(SecurityProfile, self).__init__(**kwargs) self.uefi_settings = uefi_settings self.encryption_at_host = encryption_at_host @@ -7654,8 +9525,8 @@ class SharedGallery(PirSharedGalleryResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str """ _validation = { @@ -7675,6 +9546,10 @@ def __init__( unique_id: Optional[str] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ super(SharedGallery, self).__init__(unique_id=unique_id, **kwargs) @@ -7687,35 +9562,35 @@ class SharedGalleryImage(PirSharedGalleryResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param os_type: This property allows you to specify the type of the OS that is included in the + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed 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_07_01.models.OperatingSystemTypes - :param os_state: This property allows the user to specify whether the virtual machines created + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", "Specialized". - :type os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes - :param end_of_life_date: The end of life date of the gallery image definition. This property - can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime - :param identifier: This is the gallery image definition identifier. - :type identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier - :param recommended: The properties describe the recommended machine configuration for this - Image Definition. These properties are updatable. - :type recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration - :param disallowed: Describes the disallowed disk types. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed - :param hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + :vartype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration - :param features: A list of gallery image features. - :type features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] - :param purchase_plan: Describes the gallery image definition purchase plan. This is used by + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by marketplace images. - :type purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan """ _validation = { @@ -7753,6 +9628,37 @@ def __init__( purchase_plan: Optional["ImagePurchasePlan"] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemStateTypes + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2021_07_01.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2021_07_01.models.Disallowed + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2021_07_01.models.GalleryImageFeature] + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_07_01.models.ImagePurchasePlan + """ super(SharedGalleryImage, self).__init__(unique_id=unique_id, **kwargs) self.os_type = os_type self.os_state = os_state @@ -7770,11 +9676,11 @@ class SharedGalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of shared gallery images. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImage] - :param next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with + :ivar value: Required. A list of shared gallery images. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImage] + :ivar next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with this to fetch the next page of shared gallery images. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -7793,6 +9699,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of shared gallery images. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImage] + :keyword next_link: The uri to fetch the next page of shared gallery images. Call ListNext() + with this to fetch the next page of shared gallery images. + :paramtype next_link: str + """ super(SharedGalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7807,14 +9720,14 @@ class SharedGalleryImageVersion(PirSharedGalleryResource): :vartype name: str :ivar location: Resource location. :vartype location: str - :param unique_id: The unique id of this shared gallery. - :type unique_id: str - :param published_date: The published date of the gallery image version Definition. This - property can be used for decommissioning purposes. This property is updatable. - :type published_date: ~datetime.datetime - :param end_of_life_date: The end of life date of the gallery image version Definition. This + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + :ivar published_date: The published date of the gallery image version Definition. This property + can be used for decommissioning purposes. This property is updatable. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This property is updatable. - :type end_of_life_date: ~datetime.datetime + :vartype end_of_life_date: ~datetime.datetime """ _validation = { @@ -7838,6 +9751,16 @@ def __init__( end_of_life_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + :keyword published_date: The published date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype published_date: ~datetime.datetime + :keyword end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + """ super(SharedGalleryImageVersion, self).__init__(unique_id=unique_id, **kwargs) self.published_date = published_date self.end_of_life_date = end_of_life_date @@ -7848,11 +9771,11 @@ class SharedGalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of shared gallery images versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersion] - :param next_link: The uri to fetch the next page of shared gallery image versions. Call + :ivar value: Required. A list of shared gallery images versions. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersion] + :ivar next_link: The uri to fetch the next page of shared gallery image versions. Call ListNext() with this to fetch the next page of shared gallery image versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -7871,6 +9794,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of shared gallery images versions. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersion] + :keyword next_link: The uri to fetch the next page of shared gallery image versions. Call + ListNext() with this to fetch the next page of shared gallery image versions. + :paramtype next_link: str + """ super(SharedGalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7881,11 +9811,11 @@ class SharedGalleryList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of shared galleries. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGallery] - :param next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this + :ivar value: Required. A list of shared galleries. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGallery] + :ivar next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this to fetch the next page of shared galleries. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -7904,6 +9834,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of shared galleries. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.SharedGallery] + :keyword next_link: The uri to fetch the next page of shared galleries. Call ListNext() with + this to fetch the next page of shared galleries. + :paramtype next_link: str + """ super(SharedGalleryList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7914,10 +9851,11 @@ class SharingProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param permissions: This property allows you to specify the permission of sharing gallery. + :ivar permissions: This property allows you to specify the permission of sharing gallery. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** :code:`
    `:code:`
    ` **Groups**. Possible values include: "Private", "Groups". - :type permissions: str or ~azure.mgmt.compute.v2021_07_01.models.GallerySharingPermissionTypes + :vartype permissions: str or + ~azure.mgmt.compute.v2021_07_01.models.GallerySharingPermissionTypes :ivar groups: A list of sharing profile groups. :vartype groups: list[~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroup] """ @@ -7937,6 +9875,13 @@ def __init__( permissions: Optional[Union[str, "GallerySharingPermissionTypes"]] = None, **kwargs ): + """ + :keyword permissions: This property allows you to specify the permission of sharing gallery. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Private** + :code:`
    `:code:`
    ` **Groups**. Possible values include: "Private", "Groups". + :paramtype permissions: str or + ~azure.mgmt.compute.v2021_07_01.models.GallerySharingPermissionTypes + """ super(SharingProfile, self).__init__(**kwargs) self.permissions = permissions self.groups = None @@ -7945,13 +9890,13 @@ def __init__( class SharingProfileGroup(msrest.serialization.Model): """Group of the gallery sharing profile. - :param type: This property allows you to specify the type of sharing group. + :ivar type: This property allows you to specify the type of sharing group. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** :code:`
    `:code:`
    ` **AADTenants**. Possible values include: "Subscriptions", "AADTenants". - :type type: str or ~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroupTypes - :param ids: A list of subscription/tenant ids the gallery is aimed to be shared to. - :type ids: list[str] + :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroupTypes + :ivar ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :vartype ids: list[str] """ _attribute_map = { @@ -7966,6 +9911,15 @@ def __init__( ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword type: This property allows you to specify the type of sharing group. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Subscriptions** + :code:`
    `:code:`
    ` **AADTenants**. Possible values include: "Subscriptions", + "AADTenants". + :paramtype type: str or ~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroupTypes + :keyword ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :paramtype ids: list[str] + """ super(SharingProfileGroup, self).__init__(**kwargs) self.type = type self.ids = ids @@ -7976,13 +9930,14 @@ class SharingUpdate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param operation_type: Required. This property allows you to specify the operation type of + :ivar operation_type: Required. This property allows you to specify the operation type of gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset**. Possible values include: "Add", "Remove", "Reset". - :type operation_type: str or ~azure.mgmt.compute.v2021_07_01.models.SharingUpdateOperationTypes - :param groups: A list of sharing profile groups. - :type groups: list[~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroup] + :vartype operation_type: str or + ~azure.mgmt.compute.v2021_07_01.models.SharingUpdateOperationTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroup] """ _validation = { @@ -8001,6 +9956,16 @@ def __init__( groups: Optional[List["SharingProfileGroup"]] = None, **kwargs ): + """ + :keyword operation_type: Required. This property allows you to specify the operation type of + gallery sharing update. :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` + **Add** :code:`
    `:code:`
    ` **Remove** :code:`
    `:code:`
    ` **Reset**. Possible values + include: "Add", "Remove", "Reset". + :paramtype operation_type: str or + ~azure.mgmt.compute.v2021_07_01.models.SharingUpdateOperationTypes + :keyword groups: A list of sharing profile groups. + :paramtype groups: list[~azure.mgmt.compute.v2021_07_01.models.SharingProfileGroup] + """ super(SharingUpdate, self).__init__(**kwargs) self.operation_type = operation_type self.groups = groups @@ -8009,14 +9974,14 @@ def __init__( 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:`
    ` + :ivar name: The sku name. + :vartype name: str + :ivar 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 + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long """ _attribute_map = { @@ -8033,6 +9998,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The sku name. + :paramtype name: str + :keyword tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of virtual machines in the scale set. + :paramtype capacity: long + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -8042,9 +10017,9 @@ def __init__( class SoftDeletePolicy(msrest.serialization.Model): """Contains information about the soft deletion policy of the gallery. - :param is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing + :ivar is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing them to be recovered within retention time. - :type is_soft_delete_enabled: bool + :vartype is_soft_delete_enabled: bool """ _attribute_map = { @@ -8057,6 +10032,11 @@ def __init__( is_soft_delete_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing + them to be recovered within retention time. + :paramtype is_soft_delete_enabled: bool + """ super(SoftDeletePolicy, self).__init__(**kwargs) self.is_soft_delete_enabled = is_soft_delete_enabled @@ -8064,12 +10044,12 @@ def __init__( class SpotRestorePolicy(msrest.serialization.Model): """Specifies the Spot-Try-Restore properties for the virtual machine scale set. :code:`
    `:code:`
    ` With this property customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically based on capacity availability and pricing constraint. - :param enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be + :ivar enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based on capacity availability and pricing constraints. - :type enabled: bool - :param restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the + :vartype enabled: bool + :ivar restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances. - :type restore_timeout: str + :vartype restore_timeout: str """ _attribute_map = { @@ -8084,6 +10064,15 @@ def __init__( restore_timeout: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will + be tried to be restored opportunistically based on capacity availability and pricing + constraints. + :paramtype enabled: bool + :keyword restore_timeout: Timeout value expressed as an ISO 8601 time duration after which the + platform will not try to restore the VMSS SPOT instances. + :paramtype restore_timeout: str + """ super(SpotRestorePolicy, self).__init__(**kwargs) self.enabled = enabled self.restore_timeout = restore_timeout @@ -8092,8 +10081,8 @@ def __init__( 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_07_01.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2021_07_01.models.SshPublicKey] """ _attribute_map = { @@ -8106,6 +10095,10 @@ def __init__( public_keys: Optional[List["SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.compute.v2021_07_01.models.SshPublicKey] + """ super(SshConfiguration, self).__init__(**kwargs) self.public_keys = public_keys @@ -8113,15 +10106,15 @@ def __init__( 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 + :ivar 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 + :vartype path: str + :ivar 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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - :type key_data: str + :vartype key_data: str """ _attribute_map = { @@ -8136,6 +10129,17 @@ def __init__( key_data: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype path: str + :keyword 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]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + :paramtype key_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.path = path self.key_data = key_data @@ -8146,16 +10150,16 @@ class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): 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 + :ivar 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 + :vartype private_key: str + :ivar 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 + :vartype public_key: str + :ivar id: Required. The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - :type id: str + :vartype id: str """ _validation = { @@ -8178,6 +10182,18 @@ def __init__( id: str, **kwargs ): + """ + :keyword 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. + :paramtype private_key: str + :keyword 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. + :paramtype public_key: str + :keyword id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :paramtype id: str + """ super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) self.private_key = private_key self.public_key = public_key @@ -8197,15 +10213,15 @@ class SshPublicKeyResource(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _validation = { @@ -8232,6 +10248,17 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyResource, self).__init__(location=location, tags=tags, **kwargs) self.public_key = public_key @@ -8241,11 +10268,11 @@ class SshPublicKeysGroupListResult(msrest.serialization.Model): 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_07_01.models.SshPublicKeyResource] - :param next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + :ivar value: Required. The list of SSH public keys. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.SshPublicKeyResource] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -8264,6 +10291,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of SSH public keys. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.SshPublicKeyResource] + :keyword 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. + :paramtype next_link: str + """ super(SshPublicKeysGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8272,13 +10306,13 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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. + :vartype public_key: str """ _attribute_map = { @@ -8293,6 +10327,15 @@ def __init__( public_key: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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. + :paramtype public_key: str + """ super(SshPublicKeyUpdateResource, self).__init__(tags=tags, **kwargs) self.public_key = public_key @@ -8300,21 +10343,21 @@ def __init__( 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 + :ivar 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_07_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2021_07_01.models.ImageReference + :ivar 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_07_01.models.OSDisk - :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + :vartype os_disk: ~azure.mgmt.compute.v2021_07_01.models.OSDisk + :ivar 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_07_01.models.DataDisk] + :vartype data_disks: list[~azure.mgmt.compute.v2021_07_01.models.DataDisk] """ _attribute_map = { @@ -8331,6 +10374,23 @@ def __init__( data_disks: Optional[List["DataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2021_07_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_07_01.models.OSDisk + :keyword 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 + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2021_07_01.models.DataDisk] + """ super(StorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -8358,6 +10418,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -8365,11 +10427,11 @@ def __init__( class SubResourceWithColocationStatus(SubResource): """SubResourceWithColocationStatus. - :param id: Resource Id. - :type id: str - :param colocation_status: Describes colocation status of a resource in the Proximity Placement + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement Group. - :type colocation_status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus + :vartype colocation_status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus """ _attribute_map = { @@ -8384,6 +10446,13 @@ def __init__( colocation_status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword colocation_status: Describes colocation status of a resource in the Proximity + Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus + """ super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) self.colocation_status = colocation_status @@ -8393,18 +10462,18 @@ class TargetRegion(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the region. - :type name: str - :param regional_replica_count: The number of replicas of the Image Version to be created per + :ivar name: Required. The name of the region. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per region. This property is updatable. - :type regional_replica_count: int - :param storage_account_type: Specifies the storage account type to be used to store the image. + :vartype regional_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType - :param encryption: Optional. Allows users to provide customer managed keys for encrypting the - OS and data disks in the gallery artifact. - :type encryption: ~azure.mgmt.compute.v2021_07_01.models.EncryptionImages + :vartype storage_account_type: str or ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS + and data disks in the gallery artifact. + :vartype encryption: ~azure.mgmt.compute.v2021_07_01.models.EncryptionImages """ _validation = { @@ -8427,6 +10496,21 @@ def __init__( encryption: Optional["EncryptionImages"] = None, **kwargs ): + """ + :keyword name: Required. The name of the region. + :paramtype name: str + :keyword regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :paramtype regional_replica_count: int + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountType + :keyword encryption: Optional. Allows users to provide customer managed keys for encrypting the + OS and data disks in the gallery artifact. + :paramtype encryption: ~azure.mgmt.compute.v2021_07_01.models.EncryptionImages + """ super(TargetRegion, self).__init__(**kwargs) self.name = name self.regional_replica_count = regional_replica_count @@ -8437,13 +10521,13 @@ def __init__( 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 + :ivar 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). + :vartype not_before_timeout: str + :ivar enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :vartype enable: bool """ _attribute_map = { @@ -8458,6 +10542,15 @@ def __init__( enable: Optional[bool] = None, **kwargs ): + """ + :keyword 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). + :paramtype not_before_timeout: str + :keyword enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :paramtype enable: bool + """ super(TerminateNotificationProfile, self).__init__(**kwargs) self.not_before_timeout = not_before_timeout self.enable = enable @@ -8468,23 +10561,23 @@ class ThrottledRequestsInput(LogAnalyticsInputBase): 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 + :ivar 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 + :vartype blob_container_sas_uri: str + :ivar from_time: Required. From time of the query. + :vartype from_time: ~datetime.datetime + :ivar to_time: Required. To time of the query. + :vartype to_time: ~datetime.datetime + :ivar group_by_throttle_policy: Group query result by Throttle Policy applied. + :vartype group_by_throttle_policy: bool + :ivar group_by_operation_name: Group query result by Operation Name. + :vartype group_by_operation_name: bool + :ivar group_by_resource_name: Group query result by Resource Name. + :vartype group_by_resource_name: bool + :ivar group_by_client_application_id: Group query result by Client Application ID. + :vartype group_by_client_application_id: bool + :ivar group_by_user_agent: Group query result by User Agent. + :vartype group_by_user_agent: bool """ _validation = { @@ -8517,18 +10610,37 @@ def __init__( group_by_user_agent: Optional[bool] = None, **kwargs ): + """ + :keyword blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :paramtype blob_container_sas_uri: str + :keyword from_time: Required. From time of the query. + :paramtype from_time: ~datetime.datetime + :keyword to_time: Required. To time of the query. + :paramtype to_time: ~datetime.datetime + :keyword group_by_throttle_policy: Group query result by Throttle Policy applied. + :paramtype group_by_throttle_policy: bool + :keyword group_by_operation_name: Group query result by Operation Name. + :paramtype group_by_operation_name: bool + :keyword group_by_resource_name: Group query result by Resource Name. + :paramtype group_by_resource_name: bool + :keyword group_by_client_application_id: Group query result by Client Application ID. + :paramtype group_by_client_application_id: bool + :keyword group_by_user_agent: Group query result by User Agent. + :paramtype group_by_user_agent: bool + """ 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 + :ivar 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. + :vartype secure_boot_enabled: bool + :ivar 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 + :vartype v_tpm_enabled: bool """ _attribute_map = { @@ -8543,6 +10655,14 @@ def __init__( v_tpm_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Specifies whether vTPM should be enabled on the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :paramtype v_tpm_enabled: bool + """ super(UefiSettings, self).__init__(**kwargs) self.secure_boot_enabled = secure_boot_enabled self.v_tpm_enabled = v_tpm_enabled @@ -8578,6 +10698,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -8626,6 +10748,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -8665,6 +10789,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -8674,19 +10800,19 @@ def __init__( 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_07_01.models.UpgradeMode - :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + :vartype mode: str or ~azure.mgmt.compute.v2021_07_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling upgrade. - :type rolling_upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.RollingUpgradePolicy - :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS Upgrade. - :type automatic_os_upgrade_policy: + :vartype automatic_os_upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.AutomaticOSUpgradePolicy """ @@ -8704,6 +10830,22 @@ def __init__( automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, **kwargs ): + """ + :keyword 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". + :paramtype mode: str or ~azure.mgmt.compute.v2021_07_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2021_07_01.models.AutomaticOSUpgradePolicy + """ super(UpgradePolicy, self).__init__(**kwargs) self.mode = mode self.rolling_upgrade_policy = rolling_upgrade_policy @@ -8719,12 +10861,12 @@ class Usage(msrest.serialization.Model): :ivar unit: An enum describing the unit of usage measurement. Has constant 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_07_01.models.UsageName + :ivar current_value: Required. The current usage of the resource. + :vartype current_value: int + :ivar limit: Required. The maximum permitted usage of the resource. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.compute.v2021_07_01.models.UsageName """ _validation = { @@ -8751,6 +10893,14 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword current_value: Required. The current usage of the resource. + :paramtype current_value: int + :keyword limit: Required. The maximum permitted usage of the resource. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.compute.v2021_07_01.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.current_value = current_value self.limit = limit @@ -8760,10 +10910,10 @@ def __init__( 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 + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _attribute_map = { @@ -8778,6 +10928,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -8788,16 +10944,16 @@ class UserArtifactManage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param install: Required. Required. The path and arguments to install the gallery application. + :ivar install: Required. Required. The path and arguments to install the gallery application. This is limited to 4096 characters. - :type install: str - :param remove: Required. Required. The path and arguments to remove the gallery application. + :vartype install: str + :ivar remove: Required. Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. - :type remove: str - :param update: Optional. The path and arguments to update the gallery application. If not + :vartype remove: str + :ivar update: Optional. The path and arguments to update the gallery application. If not present, then update operation will invoke remove command on the previous version and install command on the current version of the gallery application. This is limited to 4096 characters. - :type update: str + :vartype update: str """ _validation = { @@ -8819,6 +10975,18 @@ def __init__( update: Optional[str] = None, **kwargs ): + """ + :keyword install: Required. Required. The path and arguments to install the gallery + application. This is limited to 4096 characters. + :paramtype install: str + :keyword remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :paramtype remove: str + :keyword update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :paramtype update: str + """ super(UserArtifactManage, self).__init__(**kwargs) self.install = install self.remove = remove @@ -8830,12 +10998,12 @@ class UserArtifactSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage page blob. - :type media_link: str - :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + :ivar media_link: Required. Required. The mediaLink of the artifact, must be a readable storage + page blob. + :vartype media_link: str + :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. - :type default_configuration_link: str + :vartype default_configuration_link: str """ _validation = { @@ -8854,6 +11022,14 @@ def __init__( default_configuration_link: Optional[str] = None, **kwargs ): + """ + :keyword media_link: Required. Required. The mediaLink of the artifact, must be a readable + storage page blob. + :paramtype media_link: str + :keyword default_configuration_link: Optional. The defaultConfigurationLink of the artifact, + must be a readable storage page blob. + :paramtype default_configuration_link: str + """ super(UserArtifactSource, self).__init__(**kwargs) self.media_link = media_link self.default_configuration_link = default_configuration_link @@ -8884,6 +11060,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -8892,7 +11070,7 @@ def __init__( 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 + :ivar 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 @@ -8903,14 +11081,14 @@ class VaultCertificate(msrest.serialization.Model): Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type certificate_url: str - :param certificate_store: For Windows VMs, specifies the certificate store on the Virtual + :vartype certificate_url: str + :ivar 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 + :vartype certificate_store: str """ _attribute_map = { @@ -8925,6 +11103,27 @@ def __init__( certificate_store: Optional[str] = None, **kwargs ): + """ + :keyword 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:`
    `} :code:`
    ` To install certificates on a + virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for + Linux `_ or the + `Azure Key Vault virtual machine extension for Windows + `_. + :paramtype certificate_url: str + :keyword 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. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -8933,12 +11132,12 @@ def __init__( 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 + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain + :vartype source_vault: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: list[~azure.mgmt.compute.v2021_07_01.models.VaultCertificate] + :vartype vault_certificates: list[~azure.mgmt.compute.v2021_07_01.models.VaultCertificate] """ _attribute_map = { @@ -8953,6 +11152,14 @@ def __init__( vault_certificates: Optional[List["VaultCertificate"]] = None, **kwargs ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2021_07_01.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -8961,8 +11168,8 @@ def __init__( class VirtualHardDisk(msrest.serialization.Model): """Describes the uri of a disk. - :param uri: Specifies the virtual hard disk's uri. - :type uri: str + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str """ _attribute_map = { @@ -8975,6 +11182,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: Specifies the virtual hard disk's uri. + :paramtype uri: str + """ super(VirtualHardDisk, self).__init__(**kwargs) self.uri = uri @@ -8992,43 +11203,43 @@ class VirtualMachine(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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_07_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_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_07_01.models.ExtendedLocation - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :ivar 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_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -9041,46 +11252,45 @@ class VirtualMachine(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_07_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 + :vartype availability_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_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_07_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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_07_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_07_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. + :vartype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2021_07_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_07_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -9090,16 +11300,16 @@ class VirtualMachine(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -9107,18 +11317,20 @@ class VirtualMachine(Resource): 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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :ivar 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 - :param capacity_reservation: Specifies information about the capacity reservation that is used + :vartype user_data: str + :ivar capacity_reservation: Specifies information about the capacity reservation that is used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile - :param application_profile: Specifies the gallery applications that should be made available to + :vartype capacity_reservation: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to the VM/VMSS. - :type application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile + :vartype application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile """ _validation = { @@ -9203,6 +11415,129 @@ def __init__( application_profile: Optional["ApplicationProfile"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + :keyword capacity_reservation: Specifies information about the capacity reservation that is + used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. + :paramtype capacity_reservation: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile + :keyword application_profile: Specifies the gallery applications that should be made available + to the VM/VMSS. + :paramtype application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile + """ super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) self.plan = plan self.resources = None @@ -9239,13 +11574,13 @@ def __init__( 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: + :ivar vm_agent_version: The VM Agent full version. + :vartype vm_agent_version: str + :ivar extension_handlers: The virtual machine extension handler instance view. + :vartype extension_handlers: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionHandlerInstanceView] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -9262,6 +11597,15 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword vm_agent_version: The VM Agent full version. + :paramtype vm_agent_version: str + :keyword extension_handlers: The virtual machine extension handler instance view. + :paramtype extension_handlers: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) self.vm_agent_version = vm_agent_version self.extension_handlers = extension_handlers @@ -9327,6 +11671,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -9343,13 +11689,13 @@ class VirtualMachineCaptureParameters(msrest.serialization.Model): 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 + :ivar vhd_prefix: Required. The captured virtual hard disk's name prefix. + :vartype vhd_prefix: str + :ivar destination_container_name: Required. The destination container name. + :vartype destination_container_name: str + :ivar overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard disk, in case of conflict. - :type overwrite_vhds: bool + :vartype overwrite_vhds: bool """ _validation = { @@ -9372,6 +11718,15 @@ def __init__( overwrite_vhds: bool, **kwargs ): + """ + :keyword vhd_prefix: Required. The captured virtual hard disk's name prefix. + :paramtype vhd_prefix: str + :keyword destination_container_name: Required. The destination container name. + :paramtype destination_container_name: str + :keyword overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :paramtype overwrite_vhds: bool + """ super(VirtualMachineCaptureParameters, self).__init__(**kwargs) self.vhd_prefix = vhd_prefix self.destination_container_name = destination_container_name @@ -9383,8 +11738,8 @@ class VirtualMachineCaptureResult(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str :ivar schema: the schema of the captured virtual machine. :vartype schema: str :ivar content_version: the version of the content. @@ -9416,6 +11771,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) self.schema = None self.content_version = None @@ -9436,40 +11795,41 @@ class VirtualMachineExtension(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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_07_01.models.VirtualMachineExtensionInstanceView - :param suppress_failures: Indicates whether failures stemming from the extension will be + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView + :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. - :type suppress_failures: bool + :vartype suppress_failures: bool """ _validation = { @@ -9516,6 +11876,41 @@ def __init__( suppress_failures: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView + :keyword suppress_failures: Indicates whether failures stemming from the extension will be + suppressed (Operational failures such as not connecting to the VM will not be suppressed + regardless of this value). The default is false. + :paramtype suppress_failures: bool + """ super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -9533,12 +11928,12 @@ def __init__( 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_07_01.models.InstanceViewStatus + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: The extension handler status. + :vartype status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus """ _attribute_map = { @@ -9555,6 +11950,14 @@ def __init__( status: Optional["InstanceViewStatus"] = None, **kwargs ): + """ + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: The extension handler status. + :paramtype status: ~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus + """ super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) self.type = type self.type_handler_version = type_handler_version @@ -9574,23 +11977,23 @@ class VirtualMachineExtensionImage(Resource): :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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar operating_system: The operating system this extension supports. + :vartype operating_system: str + :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. + :vartype compute_role: str + :ivar handler_schema: The schema defined by publisher, where extension consumers should provide + settings in a matching schema. + :vartype handler_schema: str + :ivar 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 + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool """ _validation = { @@ -9625,6 +12028,25 @@ def __init__( supports_multiple_extensions: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword operating_system: The operating system this extension supports. + :paramtype operating_system: str + :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. + :paramtype compute_role: str + :keyword handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :paramtype handler_schema: str + :keyword 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. + :paramtype vm_scale_set_enabled: bool + :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. + :paramtype supports_multiple_extensions: bool + """ super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) self.operating_system = operating_system self.compute_role = compute_role @@ -9636,16 +12058,16 @@ def __init__( 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_07_01.models.InstanceViewStatus] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar name: The virtual machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar substatuses: The resource status information. + :vartype substatuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -9666,6 +12088,18 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword name: The virtual machine extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword substatuses: The resource status information. + :paramtype substatuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) self.name = name self.type = type @@ -9677,8 +12111,8 @@ def __init__( class VirtualMachineExtensionsListResult(msrest.serialization.Model): """The List Extension operation response. - :param value: The list of extensions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] """ _attribute_map = { @@ -9691,6 +12125,10 @@ def __init__( value: Optional[List["VirtualMachineExtension"]] = None, **kwargs ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] + """ super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -9698,33 +12136,33 @@ def __init__( 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar 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 + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :param suppress_failures: Indicates whether failures stemming from the extension will be + :vartype protected_settings: any + :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. - :type suppress_failures: bool + :vartype suppress_failures: bool """ _attribute_map = { @@ -9755,6 +12193,35 @@ def __init__( suppress_failures: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword suppress_failures: Indicates whether failures stemming from the extension will be + suppressed (Operational failures such as not connecting to the VM will not be suppressed + regardless of this value). The default is false. + :paramtype suppress_failures: bool + """ super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher @@ -9788,6 +12255,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -9803,15 +12272,15 @@ class VirtualMachineIdentity(msrest.serialization.Model): :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, + :ivar 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_07_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Virtual + :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_07_01.models.UserAssignedIdentitiesValue] """ @@ -9834,6 +12303,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_07_01.models.UserAssignedIdentitiesValue] + """ super(VirtualMachineIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -9846,18 +12327,18 @@ class VirtualMachineImageResource(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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_07_01.models.ExtendedLocation + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation """ _validation = { @@ -9883,6 +12364,20 @@ def __init__( extended_location: Optional["ExtendedLocation"] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + """ super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) self.name = name self.location = location @@ -9895,36 +12390,37 @@ class VirtualMachineImage(VirtualMachineImageResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The name of the resource. + :vartype name: str + :ivar location: Required. The supported Azure location of the resource. + :vartype location: str + :ivar 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_07_01.models.ExtendedLocation - :param plan: Used for establishing the purchase context of any 3rd Party artifact through + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - :type plan: ~azure.mgmt.compute.v2021_07_01.models.PurchasePlan - :param os_disk_image: Contains the os disk image information. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImage - :param data_disk_images: - :type data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.DataDiskImage] - :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. - :type automatic_os_upgrade_properties: + :vartype plan: ~azure.mgmt.compute.v2021_07_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: ~azure.mgmt.compute.v2021_07_01.models.AutomaticOSUpgradeProperties - :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", "V2". - :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationTypes - :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationTypes + :ivar disallowed: Specifies disallowed configuration for the VirtualMachine created from the image. - :type disallowed: ~azure.mgmt.compute.v2021_07_01.models.DisallowedConfiguration - :param features: - :type features: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineImageFeature] + :vartype disallowed: ~azure.mgmt.compute.v2021_07_01.models.DisallowedConfiguration + :ivar features: + :vartype features: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineImageFeature] """ _validation = { @@ -9964,6 +12460,40 @@ def __init__( features: Optional[List["VirtualMachineImageFeature"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The name of the resource. + :paramtype name: str + :keyword location: Required. The supported Azure location of the resource. + :paramtype location: str + :keyword 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 + `_. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2021_07_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2021_07_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationTypes + :keyword disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :paramtype disallowed: ~azure.mgmt.compute.v2021_07_01.models.DisallowedConfiguration + :keyword features: + :paramtype features: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineImageFeature] + """ 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 @@ -9977,10 +12507,10 @@ def __init__( 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 + :ivar name: The name of the feature. + :vartype name: str + :ivar value: The corresponding value for the feature. + :vartype value: str """ _attribute_map = { @@ -9995,6 +12525,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the feature. + :paramtype name: str + :keyword value: The corresponding value for the feature. + :paramtype value: str + """ super(VirtualMachineImageFeature, self).__init__(**kwargs) self.name = name self.value = value @@ -10005,18 +12541,19 @@ class VirtualMachineInstallPatchesParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param maximum_duration: Specifies the maximum amount of time that the operation will run. It + :ivar maximum_duration: Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours). - :type maximum_duration: str - :param reboot_setting: Required. Defines when it is acceptable to reboot a VM during a software + :vartype maximum_duration: str + :ivar 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_07_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_07_01.models.WindowsParameters - :param linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + :vartype reboot_setting: str or + ~azure.mgmt.compute.v2021_07_01.models.VMGuestPatchRebootSetting + :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the + API. + :vartype windows_parameters: ~azure.mgmt.compute.v2021_07_01.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the API. - :type linux_parameters: ~azure.mgmt.compute.v2021_07_01.models.LinuxParameters + :vartype linux_parameters: ~azure.mgmt.compute.v2021_07_01.models.LinuxParameters """ _validation = { @@ -10039,6 +12576,21 @@ def __init__( linux_parameters: Optional["LinuxParameters"] = None, **kwargs ): + """ + :keyword maximum_duration: Specifies the maximum amount of time that the operation will run. It + must be an ISO 8601-compliant duration string such as PT4H (4 hours). + :paramtype maximum_duration: str + :keyword reboot_setting: Required. Defines when it is acceptable to reboot a VM during a + software update operation. Possible values include: "IfRequired", "Never", "Always". + :paramtype reboot_setting: str or + ~azure.mgmt.compute.v2021_07_01.models.VMGuestPatchRebootSetting + :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :paramtype windows_parameters: ~azure.mgmt.compute.v2021_07_01.models.WindowsParameters + :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :paramtype linux_parameters: ~azure.mgmt.compute.v2021_07_01.models.LinuxParameters + """ super(VirtualMachineInstallPatchesParameters, self).__init__(**kwargs) self.maximum_duration = maximum_duration self.reboot_setting = reboot_setting @@ -10123,6 +12675,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineInstallPatchesResult, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -10143,47 +12697,47 @@ class VirtualMachineInstanceView(msrest.serialization.Model): 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. + :ivar platform_update_domain: Specifies the update domain of the virtual machine. + :vartype platform_update_domain: int + :ivar platform_fault_domain: Specifies the fault domain of the virtual machine. + :vartype platform_fault_domain: int + :ivar computer_name: The computer name assigned to the virtual machine. + :vartype computer_name: str + :ivar os_name: The Operating System running on the virtual machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the virtual machine. + :vartype os_version: str + :ivar 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_07_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_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2021_07_01.models.MaintenanceRedeployStatus - :param disks: The virtual machine disk information. - :type disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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_07_01.models.BootDiagnosticsInstanceView + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_07_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_07_01.models.InstanceViewStatus] - :param patch_status: [Preview Feature] The status of virtual machine patch operations. - :type patch_status: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePatchStatus + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar patch_status: [Preview Feature] The status of virtual machine patch operations. + :vartype patch_status: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePatchStatus """ _validation = { @@ -10229,6 +12783,43 @@ def __init__( patch_status: Optional["VirtualMachinePatchStatus"] = None, **kwargs ): + """ + :keyword platform_update_domain: Specifies the update domain of the virtual machine. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: Specifies the fault domain of the virtual machine. + :paramtype platform_fault_domain: int + :keyword computer_name: The computer name assigned to the virtual machine. + :paramtype computer_name: str + :keyword os_name: The Operating System running on the virtual machine. + :paramtype os_name: str + :keyword os_version: The version of Operating System running on the virtual machine. + :paramtype os_version: str + :keyword hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2021_07_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_07_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_07_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :keyword patch_status: [Preview Feature] The status of virtual machine patch operations. + :paramtype patch_status: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePatchStatus + """ super(VirtualMachineInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -10251,10 +12842,10 @@ def __init__( class VirtualMachineIpTag(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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -10269,6 +12860,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -10279,11 +12876,11 @@ class VirtualMachineListResult(msrest.serialization.Model): 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_07_01.models.VirtualMachine] - :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachine] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -10302,6 +12899,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ super(VirtualMachineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10312,31 +12916,31 @@ class VirtualMachineNetworkInterfaceConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The network interface configuration name. - :type name: str - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar name: Required. The network interface configuration name. + :vartype name: str + :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. - :type primary: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - :param enable_accelerated_networking: Specifies whether the network interface is accelerated + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :ivar 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 enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param network_security_group: The network security group. - :type network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceIPConfiguration] - :param dscp_configuration: - :type dscp_configuration: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar dscp_configuration: + :vartype dscp_configuration: ~azure.mgmt.compute.v2021_07_01.models.SubResource """ _validation = { @@ -10371,6 +12975,33 @@ def __init__( dscp_configuration: Optional["SubResource"] = None, **kwargs ): + """ + :keyword name: Required. The network interface configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineNetworkInterfaceIPConfiguration] + :keyword dscp_configuration: + :paramtype dscp_configuration: ~azure.mgmt.compute.v2021_07_01.models.SubResource + """ super(VirtualMachineNetworkInterfaceConfiguration, self).__init__(**kwargs) self.name = name self.primary = primary @@ -10387,8 +13018,8 @@ def __init__( class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(msrest.serialization.Model): """Describes a virtual machines network configuration's DNS settings. - :param dns_servers: List of DNS servers IP addresses. - :type dns_servers: list[str] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -10401,6 +13032,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineNetworkInterfaceDnsSettingsConfiguration, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -10410,34 +13045,34 @@ class VirtualMachineNetworkInterfaceIPConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The IP configuration name. - :type name: str - :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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_07_01.models.IPVersions - :param application_security_groups: Specifies an array of references to application security + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersions + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :ivar application_gateway_backend_address_pools: Specifies an array of references to backend address pools of application gateways. A virtual machine can reference backend address pools of multiple application gateways. Multiple virtual machines cannot use the same application gateway. - :type application_gateway_backend_address_pools: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :ivar load_balancer_backend_address_pools: Specifies an array of references to backend address pools of load balancers. A virtual machine can reference backend address pools of one public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. - :type load_balancer_backend_address_pools: + :vartype load_balancer_backend_address_pools: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] """ @@ -10469,6 +13104,38 @@ def __init__( load_balancer_backend_address_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersions + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A virtual machine can reference backend address pools of + multiple application gateways. Multiple virtual machines cannot use the same application + gateway. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword load_balancer_backend_address_pools: Specifies an array of references to backend + address pools of load balancers. A virtual machine can reference backend address pools of one + public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku + load balancer]. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + """ super(VirtualMachineNetworkInterfaceIPConfiguration, self).__init__(**kwargs) self.name = name self.subnet = subnet @@ -10485,12 +13152,12 @@ class VirtualMachinePatchStatus(msrest.serialization.Model): 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 + :ivar available_patch_summary: The available patch summary of the latest assessment operation for the virtual machine. - :type available_patch_summary: ~azure.mgmt.compute.v2021_07_01.models.AvailablePatchSummary - :param last_patch_installation_summary: The installation summary of the latest installation + :vartype available_patch_summary: ~azure.mgmt.compute.v2021_07_01.models.AvailablePatchSummary + :ivar last_patch_installation_summary: The installation summary of the latest installation operation for the virtual machine. - :type last_patch_installation_summary: + :vartype last_patch_installation_summary: ~azure.mgmt.compute.v2021_07_01.models.LastPatchInstallationSummary :ivar configuration_statuses: The enablement status of the specified patchMode. :vartype configuration_statuses: @@ -10514,6 +13181,16 @@ def __init__( last_patch_installation_summary: Optional["LastPatchInstallationSummary"] = None, **kwargs ): + """ + :keyword available_patch_summary: The available patch summary of the latest assessment + operation for the virtual machine. + :paramtype available_patch_summary: + ~azure.mgmt.compute.v2021_07_01.models.AvailablePatchSummary + :keyword last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :paramtype last_patch_installation_summary: + ~azure.mgmt.compute.v2021_07_01.models.LastPatchInstallationSummary + """ super(VirtualMachinePatchStatus, self).__init__(**kwargs) self.available_patch_summary = available_patch_summary self.last_patch_installation_summary = last_patch_installation_summary @@ -10525,29 +13202,29 @@ class VirtualMachinePublicIPAddressConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The publicIP address configuration name. - :type name: str - :param sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku - :param idle_timeout_in_minutes: The idle timeout of the public IP address. - :type idle_timeout_in_minutes: int - :param delete_option: Specify what happens to the public IP address when the VM is deleted. + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar delete_option: Specify what happens to the public IP address when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions - :param dns_settings: The dns settings to be applied on the publicIP addresses . - :type dns_settings: + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration - :param ip_tags: The list of IP tags associated with the public IP address. - :type ip_tags: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_01.models.IPVersions - :param public_ip_allocation_method: Specify the public IP allocation type. Possible values + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersions + :ivar public_ip_allocation_method: Specify the public IP allocation type. Possible values include: "Dynamic", "Static". - :type public_ip_allocation_method: str or + :vartype public_ip_allocation_method: str or ~azure.mgmt.compute.v2021_07_01.models.PublicIPAllocationMethod """ @@ -10581,6 +13258,32 @@ def __init__( public_ip_allocation_method: Optional[Union[str, "PublicIPAllocationMethod"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword sku: Describes the public IP Sku. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword delete_option: Specify what happens to the public IP address when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersions + :keyword public_ip_allocation_method: Specify the public IP allocation type. Possible values + include: "Dynamic", "Static". + :paramtype public_ip_allocation_method: str or + ~azure.mgmt.compute.v2021_07_01.models.PublicIPAllocationMethod + """ super(VirtualMachinePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.sku = sku @@ -10598,10 +13301,10 @@ class VirtualMachinePublicIPAddressDnsSettingsConfiguration(msrest.serialization All required parameters must be populated in order to send to Azure. - :param domain_name_label: Required. The Domain name label prefix of the PublicIPAddress + :ivar domain_name_label: Required. The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. - :type domain_name_label: str + :vartype domain_name_label: str """ _validation = { @@ -10618,6 +13321,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword domain_name_label: Required. The Domain name label prefix of the PublicIPAddress + resources that will be created. The generated name label is the concatenation of the domain + name label and vm network profile unique ID. + :paramtype domain_name_label: str + """ super(VirtualMachinePublicIPAddressDnsSettingsConfiguration, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -10625,9 +13334,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -10640,6 +13349,11 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineReimageParameters, self).__init__(**kwargs) self.temp_disk = temp_disk @@ -10657,33 +13371,33 @@ class VirtualMachineRunCommand(Resource): :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_07_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -10735,6 +13449,35 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -10752,23 +13495,23 @@ def __init__( 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", + :ivar execution_state: Script execution status. Possible values include: "Unknown", "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". - :type execution_state: str or ~azure.mgmt.compute.v2021_07_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_07_01.models.InstanceViewStatus] + :vartype execution_state: str or ~azure.mgmt.compute.v2021_07_01.models.ExecutionState + :ivar execution_message: Communicate script configuration errors or execution messages. + :vartype execution_message: str + :ivar exit_code: Exit code returned from script execution. + :vartype exit_code: int + :ivar output: Script output stream. + :vartype output: str + :ivar error: Script error stream. + :vartype error: str + :ivar start_time: Script start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Script end time. + :vartype end_time: ~datetime.datetime + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ _attribute_map = { @@ -10795,6 +13538,25 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword execution_state: Script execution status. Possible values include: "Unknown", + "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :paramtype execution_state: str or ~azure.mgmt.compute.v2021_07_01.models.ExecutionState + :keyword execution_message: Communicate script configuration errors or execution messages. + :paramtype execution_message: str + :keyword exit_code: Exit code returned from script execution. + :paramtype exit_code: int + :keyword output: Script output stream. + :paramtype output: str + :keyword error: Script error stream. + :paramtype error: str + :keyword start_time: Script start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Script end time. + :paramtype end_time: ~datetime.datetime + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) self.execution_state = execution_state self.execution_message = execution_message @@ -10809,12 +13571,12 @@ def __init__( 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 + :ivar script: Specifies the script content to be executed on the VM. + :vartype script: str + :ivar script_uri: Specifies the script download location. + :vartype script_uri: str + :ivar command_id: Specifies a commandId of predefined built-in script. + :vartype command_id: str """ _attribute_map = { @@ -10831,6 +13593,14 @@ def __init__( command_id: Optional[str] = None, **kwargs ): + """ + :keyword script: Specifies the script content to be executed on the VM. + :paramtype script: str + :keyword script_uri: Specifies the script download location. + :paramtype script_uri: str + :keyword command_id: Specifies a commandId of predefined built-in script. + :paramtype command_id: str + """ super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) self.script = script self.script_uri = script_uri @@ -10842,10 +13612,10 @@ class VirtualMachineRunCommandsListResult(msrest.serialization.Model): 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_07_01.models.VirtualMachineRunCommand] - :param next_link: The uri to fetch the next page of run commands. - :type next_link: str + :ivar value: Required. The list of run commands. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] + :ivar next_link: The uri to fetch the next page of run commands. + :vartype next_link: str """ _validation = { @@ -10864,6 +13634,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of run commands. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] + :keyword next_link: The uri to fetch the next page of run commands. + :paramtype next_link: str + """ super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10874,31 +13650,31 @@ class VirtualMachineRunCommandUpdate(UpdateResource): 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_07_01.models.VirtualMachineRunCommandScriptSource - :param parameters: The parameters used by the script. - :type parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] - :param protected_parameters: The parameters used by the script. - :type protected_parameters: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] - :param async_execution: Optional. If set to true, provisioning will complete as soon as the + :ivar 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 + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the VM when executing the run command. + :vartype run_as_user: str + :ivar 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 + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar 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 + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be uploaded. - :type error_blob_uri: str + :vartype 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. @@ -10941,6 +13717,33 @@ def __init__( error_blob_uri: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword source: The source of the run command script. + :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2021_07_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) self.source = source self.parameters = parameters @@ -10968,75 +13771,75 @@ class VirtualMachineScaleSet(Resource): :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_07_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :ivar 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_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_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_07_01.models.ExtendedLocation - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine Scale Set. + :vartype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2021_07_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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 + :vartype 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, + :ivar 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 + :vartype single_placement_group: bool + :ivar zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. - :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 + :vartype zone_balance: bool + :ivar platform_fault_domain_count: Fault Domain count for each placement group. + :vartype platform_fault_domain_count: int + :ivar 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_07_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_07_01.models.SubResource - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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. + :vartype host_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :ivar scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. - :type scale_in_policy: ~azure.mgmt.compute.v2021_07_01.models.ScaleInPolicy - :param orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. + :vartype scale_in_policy: ~azure.mgmt.compute.v2021_07_01.models.ScaleInPolicy + :ivar 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_07_01.models.OrchestrationMode - :param spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale + :vartype orchestration_mode: str or ~azure.mgmt.compute.v2021_07_01.models.OrchestrationMode + :ivar spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale set. - :type spot_restore_policy: ~azure.mgmt.compute.v2021_07_01.models.SpotRestorePolicy + :vartype spot_restore_policy: ~azure.mgmt.compute.v2021_07_01.models.SpotRestorePolicy """ _validation = { @@ -11103,6 +13906,75 @@ def __init__( spot_restore_policy: Optional["SpotRestorePolicy"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine Scale Set. + :paramtype extended_location: ~azure.mgmt.compute.v2021_07_01.models.ExtendedLocation + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. zoneBalance property can only be set if the zones + property of the scale set contains more than one zone. If there are no zones or only one zone + specified, then zoneBalance property should not be set. + :paramtype zone_balance: bool + :keyword platform_fault_domain_count: Fault Domain count for each placement group. + :paramtype platform_fault_domain_count: int + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :keyword scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in + the Virtual Machine Scale Set. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2021_07_01.models.ScaleInPolicy + :keyword orchestration_mode: Specifies the orchestration mode for the virtual machine scale + set. Possible values include: "Uniform", "Flexible". + :paramtype orchestration_mode: str or ~azure.mgmt.compute.v2021_07_01.models.OrchestrationMode + :keyword spot_restore_policy: Specifies the Spot Restore properties for the virtual machine + scale set. + :paramtype spot_restore_policy: ~azure.mgmt.compute.v2021_07_01.models.SpotRestorePolicy + """ super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -11132,39 +14004,39 @@ class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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 + :vartype lun: int + :ivar 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_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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", + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", "Empty", "Attach". - :type create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes - :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + :vartype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :ivar 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: + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetManagedDiskParameters - :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + :ivar 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. + :vartype disk_iops_read_write: long + :ivar 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 + :vartype disk_m_bps_read_write: long """ _validation = { @@ -11198,6 +14070,41 @@ def __init__( disk_m_bps_read_write: Optional[int] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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. + :paramtype lun: int + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :keyword 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. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword 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. + :paramtype disk_iops_read_write: long + :keyword 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. + :paramtype disk_m_bps_read_write: long + """ super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) self.name = name self.lun = lun @@ -11217,41 +14124,41 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :param name: The name of the extension. - :type name: 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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] - :param suppress_failures: Indicates whether failures stemming from the extension will be + :vartype provision_after_extensions: list[str] + :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. - :type suppress_failures: bool + :vartype suppress_failures: bool """ _validation = { @@ -11293,6 +14200,39 @@ def __init__( suppress_failures: Optional[bool] = None, **kwargs ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + :keyword suppress_failures: Indicates whether failures stemming from the extension will be + suppressed (Operational failures such as not connecting to the VM will not be suppressed + regardless of this value). The default is false. + :paramtype suppress_failures: bool + """ super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) self.name = name self.type = None @@ -11314,11 +14254,11 @@ class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): 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_07_01.models.VirtualMachineScaleSetExtension] - :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -11337,6 +14277,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -11345,13 +14292,14 @@ def __init__( 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_07_01.models.VirtualMachineScaleSetExtension] - :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] + :ivar 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 + :vartype extensions_time_budget: str """ _attribute_map = { @@ -11366,6 +14314,16 @@ def __init__( extensions_time_budget: Optional[str] = None, **kwargs ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] + :keyword 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. + :paramtype extensions_time_budget: str + """ super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) self.extensions = extensions self.extensions_time_budget = extensions_time_budget @@ -11382,37 +14340,37 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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 + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] - :param suppress_failures: Indicates whether failures stemming from the extension will be + :vartype provision_after_extensions: list[str] + :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. - :type suppress_failures: bool + :vartype suppress_failures: bool """ _validation = { @@ -11454,6 +14412,37 @@ def __init__( suppress_failures: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + :keyword suppress_failures: Indicates whether failures stemming from the extension will be + suppressed (Operational failures such as not connecting to the VM will not be suppressed + regardless of this value). The default is false. + :paramtype suppress_failures: bool + """ super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -11481,17 +14470,16 @@ class VirtualMachineScaleSetIdentity(msrest.serialization.Model): :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 + :ivar 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_07_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: + :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceIdentityType + :ivar 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, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -11514,6 +14502,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceIdentityType + :keyword 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}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -11546,6 +14548,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -11562,8 +14566,8 @@ class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtensionsSummary] - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] :ivar orchestration_services: The orchestration services information. :vartype orchestration_services: list[~azure.mgmt.compute.v2021_07_01.models.OrchestrationServiceSummary] @@ -11588,6 +14592,10 @@ def __init__( statuses: Optional[List["InstanceViewStatus"]] = None, **kwargs ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + """ super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) self.virtual_machine = None self.extensions = None @@ -11617,6 +14625,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -11626,39 +14636,40 @@ class VirtualMachineScaleSetIPConfiguration(SubResource): 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_07_01.models.ApiEntityReference - :param primary: Specifies the primary network interface in case the virtual machine has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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_07_01.models.IPVersion - :param application_gateway_backend_address_pools: Specifies an array of references to backend + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersion + :ivar 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: + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param load_balancer_backend_address_pools: Specifies an array of references to backend address + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :ivar 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: + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :ivar 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. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_07_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_07_01.models.SubResource] """ _validation = { @@ -11693,6 +14704,44 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The IP configuration name. + :paramtype name: str + :keyword subnet: Specifies the identifier of the subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersion + :keyword 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. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword 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. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + """ super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -11708,10 +14757,10 @@ def __init__( 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 + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :vartype tag: str """ _attribute_map = { @@ -11726,6 +14775,12 @@ def __init__( tag: Optional[str] = None, **kwargs ): + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :paramtype tag: str + """ super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) self.ip_tag_type = ip_tag_type self.tag = tag @@ -11736,11 +14791,12 @@ class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): 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_07_01.models.UpgradeOperationHistoricalStatusInfo] - :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2021_07_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -11759,6 +14815,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of OS upgrades performed on the virtual machine scale set. + :paramtype value: + list[~azure.mgmt.compute.v2021_07_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -11769,11 +14833,11 @@ class VirtualMachineScaleSetListResult(msrest.serialization.Model): 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_07_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -11792,6 +14856,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -11802,11 +14873,11 @@ class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): 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_07_01.models.VirtualMachineScaleSetSku] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetSku] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -11825,6 +14896,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the virtual machine scale set. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetSku] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -11835,11 +14913,11 @@ class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): 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_07_01.models.VirtualMachineScaleSet] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -11858,6 +14936,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -11866,14 +14951,16 @@ def __init__( 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: + :ivar 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_07_01.models.StorageAccountTypes - :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for the managed disk. - :type disk_encryption_set: ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters """ _attribute_map = { @@ -11888,6 +14975,18 @@ def __init__( disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): + """ + :keyword 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". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2021_07_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2021_07_01.models.DiskEncryptionSetParameters + """ super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) self.storage_account_type = storage_account_type self.disk_encryption_set = disk_encryption_set @@ -11898,31 +14997,31 @@ class VirtualMachineScaleSetNetworkConfiguration(SubResource): 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: Required. The network configuration name. + :vartype name: str + :ivar 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 + :vartype primary: bool + :ivar 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_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: Specifies the IP configurations of the network interface. - :type ip_configurations: + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions """ _validation = { @@ -11957,6 +15056,33 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: Required. The network configuration name. + :paramtype name: str + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + """ super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -11972,8 +15098,8 @@ def __init__( 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] + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] """ _attribute_map = { @@ -11986,6 +15112,10 @@ def __init__( dns_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword dns_servers: List of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) self.dns_servers = dns_servers @@ -11993,17 +15123,17 @@ def __init__( 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 + :ivar 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_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion """ _attribute_map = { @@ -12020,6 +15150,19 @@ def __init__( network_api_version: Optional[Union[str, "NetworkApiVersion"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion + """ super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -12031,43 +15174,43 @@ class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): 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 + :ivar name: The disk name. + :vartype name: str + :ivar 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_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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_07_01.models.DiskCreateOptionTypes - :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + :vartype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :ivar 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_07_01.models.DiffDiskSettings - :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + :vartype diff_disk_settings: ~azure.mgmt.compute.v2021_07_01.models.DiffDiskSettings + :ivar 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 + :vartype disk_size_gb: int + :ivar 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_07_01.models.OperatingSystemTypes - :param image: Specifies information about the unmanaged user image to base the scale set on. - :type image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk - :param vhd_containers: Specifies the container urls that are used to store operating system + :vartype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :ivar 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: + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -12103,6 +15246,46 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword name: The disk name. + :paramtype name: str + :keyword 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". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_07_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2021_07_01.models.DiffDiskSettings + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_07_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) self.name = name self.caching = caching @@ -12119,20 +15302,19 @@ def __init__( 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 + :ivar 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. - :type admin_username: str - :param admin_password: Specifies the password of the administrator account. + :vartype computer_name_prefix: str + :ivar 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. + :vartype admin_username: str + :ivar 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 @@ -12146,28 +15328,28 @@ class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): :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 + :vartype admin_password: str + :ivar 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 + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. - :type windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration - :param linux_configuration: Specifies the Linux operating system settings on the virtual + :vartype windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration + :ivar 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 `_. - :type linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration - :param secrets: Specifies set of certificates that should be installed onto the virtual - machines in the scale set. To install certificates on a virtual machine it is recommended to - use the `Azure Key Vault virtual machine extension for Linux + :vartype linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. To install certificates on a virtual machine it is recommended to use the + `Azure Key Vault virtual machine extension for Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] + :vartype secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] """ _attribute_map = { @@ -12192,6 +15374,57 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype computer_name_prefix: str + :keyword 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. + :paramtype admin_username: str + :keyword 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 + `_. + :paramtype admin_password: str + :keyword 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 + `_. + :paramtype custom_data: str + :keyword windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration + :keyword 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 + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. To install certificates on a virtual machine it is recommended to + use the `Azure Key Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) self.computer_name_prefix = computer_name_prefix self.admin_username = admin_username @@ -12207,26 +15440,26 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Mo All required parameters must be populated in order to send to Azure. - :param name: Required. The publicIP address configuration name. - :type name: str - :param sku: Describes the public IP Sku. - :type sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku - :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: + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_07_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_07_01.models.VirtualMachineScaleSetIpTag] - :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. - :type public_ip_prefix: ~azure.mgmt.compute.v2021_07_01.models.SubResource - :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_01.models.IPVersion - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersion + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions """ _validation = { @@ -12257,6 +15490,28 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword name: Required. The publicIP address configuration name. + :paramtype name: str + :keyword sku: Describes the public IP Sku. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersion + :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + """ super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.sku = sku @@ -12273,10 +15528,10 @@ class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.seria 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 + :ivar 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 + :vartype domain_name_label: str """ _validation = { @@ -12293,6 +15548,12 @@ def __init__( domain_name_label: str, **kwargs ): + """ + :keyword 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. + :paramtype domain_name_label: str + """ super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) self.domain_name_label = domain_name_label @@ -12300,9 +15561,9 @@ def __init__( 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 + :ivar 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 + :vartype temp_disk: bool """ _attribute_map = { @@ -12315,19 +15576,24 @@ def __init__( temp_disk: Optional[bool] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + """ super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **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 + :ivar 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 + :vartype temp_disk: bool + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -12342,6 +15608,15 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype temp_disk: bool + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) self.instance_ids = instance_ids @@ -12375,6 +15650,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -12416,6 +15693,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -12426,21 +15705,22 @@ def __init__( 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 + :ivar 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_07_01.models.ImageReference - :param os_disk: Specifies information about the operating system disk used by the virtual + :vartype image_reference: ~azure.mgmt.compute.v2021_07_01.models.ImageReference + :ivar 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_07_01.models.VirtualMachineScaleSetOSDisk - :param data_disks: Specifies the parameters that are used to add data disks to the virtual + :vartype os_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetOSDisk + :ivar 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_07_01.models.VirtualMachineScaleSetDataDisk] + :vartype data_disks: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -12457,6 +15737,24 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword 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. + :paramtype image_reference: ~azure.mgmt.compute.v2021_07_01.models.ImageReference + :keyword 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 + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetOSDisk + :keyword 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 + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -12466,45 +15764,45 @@ def __init__( 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_07_01.models.Sku - :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The virtual machine scale set sku. + :vartype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. - :type plan: ~azure.mgmt.compute.v2021_07_01.models.Plan - :param identity: The identity of the virtual machine scale set, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentity - :param upgrade_policy: The upgrade policy. - :type upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy - :param automatic_repairs_policy: Policy for automatic repairs. - :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy - :param virtual_machine_profile: The virtual machine profile. - :type virtual_machine_profile: + :vartype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: ~azure.mgmt.compute.v2021_07_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 + :ivar overprovision: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + :vartype overprovision: bool + :ivar 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, + :vartype do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar 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 + :vartype single_placement_group: bool + :ivar 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_07_01.models.AdditionalCapabilities - :param scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :ivar scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. - :type scale_in_policy: ~azure.mgmt.compute.v2021_07_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 + :vartype scale_in_policy: ~azure.mgmt.compute.v2021_07_01.models.ScaleInPolicy + :ivar 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_07_01.models.SubResource + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource """ _attribute_map = { @@ -12541,6 +15839,49 @@ def __init__( proximity_placement_group: Optional["SubResource"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The virtual machine scale set sku. + :paramtype sku: ~azure.mgmt.compute.v2021_07_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2021_07_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2021_07_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword 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. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword 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. + :paramtype single_placement_group: bool + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :keyword scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in + the Virtual Machine Scale Set. + :paramtype scale_in_policy: ~azure.mgmt.compute.v2021_07_01.models.ScaleInPolicy + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + """ super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) self.sku = sku self.plan = plan @@ -12559,34 +15900,34 @@ def __init__( 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_07_01.models.ApiEntityReference - :param primary: Specifies the primary IP Configuration in case the network interface has more + :ivar id: Resource Id. + :vartype id: str + :ivar name: The IP configuration name. + :vartype name: str + :ivar subnet: The subnet. + :vartype subnet: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :ivar 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: + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + :ivar 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_07_01.models.IPVersion - :param application_gateway_backend_address_pools: The application gateway backend address - pools. - :type application_gateway_backend_address_pools: + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param application_security_groups: Specifies an array of references to application security + :ivar application_security_groups: Specifies an array of references to application security group. - :type application_security_groups: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] - :param load_balancer_backend_address_pools: The load balancer backend address pools. - :type load_balancer_backend_address_pools: + :vartype application_security_groups: list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_07_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_07_01.models.SubResource] """ _attribute_map = { @@ -12617,6 +15958,38 @@ def __init__( load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The IP configuration name. + :paramtype name: str + :keyword subnet: The subnet. + :paramtype subnet: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword 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". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2021_07_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2021_07_01.models.SubResource] + """ super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name self.subnet = subnet @@ -12632,30 +16005,30 @@ def __init__( 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 + :ivar id: Resource Id. + :vartype id: str + :ivar name: The network configuration name. + :vartype name: str + :ivar primary: Whether this is a primary NIC on a virtual machine. + :vartype primary: bool + :ivar 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_07_01.models.SubResource - :param dns_settings: The dns settings to be applied on the network interfaces. - :type dns_settings: + :vartype enable_accelerated_networking: bool + :ivar enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :vartype enable_fpga: bool + :ivar network_security_group: The network security group. + :vartype network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings - :param ip_configurations: The virtual machine scale set IP Configuration. - :type ip_configurations: + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateIPConfiguration] - :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. - :type enable_ip_forwarding: bool - :param delete_option: Specify what happens to the network interface when the VM is deleted. + :ivar enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :vartype enable_ip_forwarding: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions """ _attribute_map = { @@ -12686,6 +16059,32 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The network configuration name. + :paramtype name: str + :keyword primary: Whether this is a primary NIC on a virtual machine. + :paramtype primary: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + """ super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name self.primary = primary @@ -12701,17 +16100,17 @@ def __init__( 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 + :ivar 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_07_01.models.ApiEntityReference - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :vartype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - :param network_api_version: specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. Possible values include: "2020-11-01". - :type network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion + :vartype network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion """ _attribute_map = { @@ -12728,6 +16127,19 @@ def __init__( network_api_version: Optional[Union[str, "NetworkApiVersion"]] = None, **kwargs ): + """ + :keyword 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}'. + :paramtype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2021_07_01.models.NetworkApiVersion + """ super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) self.health_probe = health_probe self.network_interface_configurations = network_interface_configurations @@ -12737,23 +16149,23 @@ def __init__( 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_07_01.models.CachingTypes - :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :ivar 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 + :vartype write_accelerator_enabled: bool + :ivar 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 + :vartype disk_size_gb: int + :ivar 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_07_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: + :vartype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetManagedDiskParameters """ @@ -12777,6 +16189,26 @@ def __init__( managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2021_07_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword 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. + :paramtype disk_size_gb: int + :keyword 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. + :paramtype image: ~azure.mgmt.compute.v2021_07_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetManagedDiskParameters + """ super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) self.caching = caching self.write_accelerator_enabled = write_accelerator_enabled @@ -12789,14 +16221,14 @@ def __init__( 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_07_01.models.WindowsConfiguration - :param linux_configuration: The Linux Configuration of the OS profile. - :type linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration - :param secrets: The List of certificates for addition to the VM. - :type secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] + :ivar custom_data: A base-64 encoded string of custom data. + :vartype custom_data: str + :ivar windows_configuration: The Windows Configuration of the OS profile. + :vartype windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] """ _attribute_map = { @@ -12815,6 +16247,16 @@ def __init__( secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): + """ + :keyword custom_data: A base-64 encoded string of custom data. + :paramtype custom_data: str + :keyword windows_configuration: The Windows Configuration of the OS profile. + :paramtype windows_configuration: ~azure.mgmt.compute.v2021_07_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2021_07_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2021_07_01.models.VaultSecretGroup] + """ super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) self.custom_data = custom_data self.windows_configuration = windows_configuration @@ -12825,16 +16267,16 @@ def __init__( 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: + :ivar name: The publicIP address configuration name. + :vartype name: str + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings - :param delete_option: Specify what happens to the public IP when the VM is deleted. Possible + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible values include: "Delete", "Detach". - :type delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + :vartype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions """ _attribute_map = { @@ -12853,6 +16295,18 @@ def __init__( delete_option: Optional[Union[str, "DeleteOptions"]] = None, **kwargs ): + """ + :keyword name: The publicIP address configuration name. + :paramtype name: str + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2021_07_01.models.DeleteOptions + """ super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes @@ -12863,12 +16317,13 @@ def __init__( 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_07_01.models.ImageReference - :param os_disk: The OS disk. - :type os_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateOSDisk - :param data_disks: The data disks. - :type data_disks: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetDataDisk] + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2021_07_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetDataDisk] """ _attribute_map = { @@ -12885,6 +16340,15 @@ def __init__( data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, **kwargs ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2021_07_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetDataDisk] + """ super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) self.image_reference = image_reference self.os_disk = os_disk @@ -12894,31 +16358,33 @@ def __init__( 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_07_01.models.VirtualMachineScaleSetUpdateOSProfile - :param storage_profile: The virtual machine scale set storage profile. - :type storage_profile: + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateStorageProfile - :param network_profile: The virtual machine scale set network profile. - :type network_profile: + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateNetworkProfile - :param security_profile: The virtual machine scale set Security profile. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param diagnostics_profile: The virtual machine scale set diagnostics profile. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param extension_profile: The virtual machine scale set extension profile. - :type extension_profile: + :ivar security_profile: The virtual machine scale set Security profile. + :vartype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2021_07_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. + :ivar license_type: The license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar 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_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :vartype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :ivar 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 + :vartype user_data: str """ _attribute_map = { @@ -12949,6 +16415,35 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword security_profile: The virtual machine scale set Security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -12975,20 +16470,20 @@ class VirtualMachineScaleSetVM(Resource): :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 location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype 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_07_01.models.Sku - :param plan: Specifies information about the marketplace image used to create the virtual + :ivar 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_07_01.models.Plan + :vartype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan :ivar resources: The virtual machine child extension resources. :vartype resources: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] :ivar zones: The virtual machine zones. @@ -13001,29 +16496,29 @@ class VirtualMachineScaleSetVM(Resource): :ivar instance_view: The virtual machine instance view. :vartype instance_view: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceView - :param hardware_profile: Specifies the hardware settings for the virtual machine. - :type hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile + :ivar 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_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings for the virtual machine. - :type os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile - :param network_profile_configuration: Specifies the network profile configuration of the - virtual machine. - :type network_profile_configuration: + :vartype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -13033,10 +16528,10 @@ class VirtualMachineScaleSetVM(Resource): `_ :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_07_01.models.SubResource + :vartype availability_set: ~azure.mgmt.compute.v2021_07_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 + :ivar 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: @@ -13046,16 +16541,16 @@ class VirtualMachineScaleSetVM(Resource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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: + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMProtectionPolicy - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :ivar 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 + :vartype user_data: str """ _validation = { @@ -13124,6 +16619,69 @@ def __init__( user_data: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile + :keyword 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. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMProtectionPolicy + :keyword 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. + :paramtype user_data: str + """ super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) self.instance_id = None self.sku = None @@ -13160,36 +16718,37 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any + :vartype protected_settings: any :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_07_01.models.VirtualMachineExtensionInstanceView - :param suppress_failures: Indicates whether failures stemming from the extension will be + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView + :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. - :type suppress_failures: bool + :vartype suppress_failures: bool """ _validation = { @@ -13231,6 +16790,37 @@ def __init__( suppress_failures: Optional[bool] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView + :keyword suppress_failures: Indicates whether failures stemming from the extension will be + suppressed (Operational failures such as not connecting to the VM will not be suppressed + regardless of this value). The default is false. + :paramtype suppress_failures: bool + """ super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) self.name = None self.type = None @@ -13250,8 +16840,8 @@ def __init__( 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_07_01.models.VirtualMachineScaleSetVMExtension] + :ivar value: The list of VMSS VM extensions. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension] """ _attribute_map = { @@ -13264,6 +16854,11 @@ def __init__( value: Optional[List["VirtualMachineScaleSetVMExtension"]] = None, **kwargs ): + """ + :keyword value: The list of VMSS VM extensions. + :paramtype value: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension] + """ super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) self.value = value @@ -13294,6 +16889,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -13310,32 +16907,32 @@ class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): :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 + :ivar 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 + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :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 + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param enable_automatic_upgrade: Indicates whether the extension should be automatically + :vartype auto_upgrade_minor_version: bool + :ivar 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: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype enable_automatic_upgrade: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :param suppress_failures: Indicates whether failures stemming from the extension will be + :vartype protected_settings: any + :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. - :type suppress_failures: bool + :vartype suppress_failures: bool """ _validation = { @@ -13373,6 +16970,34 @@ def __init__( suppress_failures: Optional[bool] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword suppress_failures: Indicates whether failures stemming from the extension will be + suppressed (Operational failures such as not connecting to the VM will not be suppressed + regardless of this value). The default is false. + :paramtype suppress_failures: bool + """ super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) self.name = None self.type = None @@ -13390,10 +17015,10 @@ def __init__( 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 + :ivar 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] + :vartype instance_ids: list[str] """ _attribute_map = { @@ -13406,6 +17031,12 @@ def __init__( instance_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword 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. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -13415,8 +17046,8 @@ class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): 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] + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] """ _validation = { @@ -13433,6 +17064,10 @@ def __init__( instance_ids: List[str], **kwargs ): + """ + :keyword instance_ids: Required. The virtual machine scale set instance ids. + :paramtype instance_ids: list[str] + """ super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) self.instance_ids = instance_ids @@ -13442,39 +17077,39 @@ class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :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_07_01.models.VirtualMachineAgentInstanceView - :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. - :type maintenance_redeploy_status: + :ivar platform_update_domain: The Update Domain count. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain count. + :vartype platform_fault_domain: int + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: ~azure.mgmt.compute.v2021_07_01.models.MaintenanceRedeployStatus - :param disks: The disks information. - :type disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] - :param extensions: The extensions information. - :type extensions: + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView] :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineHealthStatus - :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + :ivar 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_07_01.models.BootDiagnosticsInstanceView - :param statuses: The resource status information. - :type statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_07_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_07_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 + :ivar 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 + :vartype placement_group_id: str """ _validation = { @@ -13512,6 +17147,34 @@ def __init__( placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword platform_update_domain: The Update Domain count. + :paramtype platform_update_domain: int + :keyword platform_fault_domain: The Fault Domain count. + :paramtype platform_fault_domain: int + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_07_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2021_07_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionInstanceView] + :keyword 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. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2021_07_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) self.platform_update_domain = platform_update_domain self.platform_fault_domain = platform_fault_domain @@ -13532,11 +17195,11 @@ class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of virtual machine scale sets VMs. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVM] - :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVM] + :ivar 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 + :vartype next_link: str """ _validation = { @@ -13555,6 +17218,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVM] + :keyword 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. + :paramtype next_link: str + """ super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -13563,8 +17233,8 @@ def __init__( class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): """Describes a virtual machine scale set VM network profile. - :param network_interface_configurations: The list of network configurations. - :type network_interface_configurations: + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfiguration] """ @@ -13578,6 +17248,11 @@ def __init__( network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): + """ + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) self.network_interface_configurations = network_interface_configurations @@ -13585,27 +17260,27 @@ def __init__( 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_07_01.models.VirtualMachineScaleSetOSProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetStorageProfile - :param network_profile: Specifies properties of the network interfaces of the virtual machines + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines in the scale set. - :type network_profile: + :vartype network_profile: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :ivar security_profile: Specifies the Security related profile settings for the virtual machines in the scale set. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param extension_profile: Specifies a collection of settings for extensions installed on - virtual machines in the scale set. - :type extension_profile: + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtensionProfile - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -13615,34 +17290,36 @@ class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): :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. + :vartype license_type: str + :ivar 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_07_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype priority: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :ivar 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_07_01.models.BillingProfile - :param scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile - :param user_data: UserData for the virtual machines in the scale set, which must be base-64 + :vartype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :ivar user_data: UserData for the virtual machines in the scale set, 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 - :param capacity_reservation: Specifies the capacity reservation related details of a scale set. + :vartype user_data: str + :ivar capacity_reservation: Specifies the capacity reservation related details of a scale set. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile - :param application_profile: Specifies the gallery applications that should be made available to + :vartype capacity_reservation: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to the VM/VMSS. - :type application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile + :vartype application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile """ _attribute_map = { @@ -13681,6 +17358,68 @@ def __init__( application_profile: Optional["ApplicationProfile"] = None, **kwargs ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetNetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :paramtype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtensionProfile + :keyword 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. + :paramtype license_type: str + :keyword 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". + :paramtype priority: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :keyword user_data: UserData for the virtual machines in the scale set, which must be base-64 + encoded. Customer should not pass any secrets in here. :code:`
    `:code:`
    `Minimum + api-version: 2021-03-01. + :paramtype user_data: str + :keyword capacity_reservation: Specifies the capacity reservation related details of a scale + set. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. + :paramtype capacity_reservation: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile + :keyword application_profile: Specifies the gallery applications that should be made available + to the VM/VMSS. + :paramtype application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile + """ super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) self.os_profile = os_profile self.storage_profile = storage_profile @@ -13701,13 +17440,13 @@ def __init__( 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 + :ivar 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 + :vartype protect_from_scale_in: bool + :ivar 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 + :vartype protect_from_scale_set_actions: bool """ _attribute_map = { @@ -13722,6 +17461,15 @@ def __init__( protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): + """ + :keyword protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :paramtype protect_from_scale_in: bool + :keyword 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. + :paramtype protect_from_scale_set_actions: bool + """ 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 @@ -13730,24 +17478,24 @@ def __init__( class VirtualMachineSize(msrest.serialization.Model): """Describes the properties of a VM size. - :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. For + :ivar name: The name of the virtual machine size. + :vartype name: str + :ivar number_of_cores: The number of cores supported by the virtual machine size. For Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or https://docs.microsoft.com/rest/api/compute/resourceskus/list. - :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 + :vartype number_of_cores: int + :ivar os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :vartype os_disk_size_in_mb: int + :ivar 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 + :vartype resource_disk_size_in_mb: int + :ivar memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :vartype memory_in_mb: int + :ivar max_data_disk_count: The maximum number of data disks that can be attached to the virtual + machine size. + :vartype max_data_disk_count: int """ _attribute_map = { @@ -13770,6 +17518,26 @@ def __init__( max_data_disk_count: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the virtual machine size. + :paramtype name: str + :keyword number_of_cores: The number of cores supported by the virtual machine size. For + Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM + uses. For accurate vCPU count, please refer to + https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or + https://docs.microsoft.com/rest/api/compute/resourceskus/list. + :paramtype number_of_cores: int + :keyword os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :paramtype os_disk_size_in_mb: int + :keyword resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual + machine size. + :paramtype resource_disk_size_in_mb: int + :keyword memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :paramtype memory_in_mb: int + :keyword max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :paramtype max_data_disk_count: int + """ super(VirtualMachineSize, self).__init__(**kwargs) self.name = name self.number_of_cores = number_of_cores @@ -13782,8 +17550,8 @@ def __init__( class VirtualMachineSizeListResult(msrest.serialization.Model): """The List Virtual Machine operation response. - :param value: The list of virtual machine sizes. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSize] + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSize] """ _attribute_map = { @@ -13796,6 +17564,10 @@ def __init__( value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSize] + """ super(VirtualMachineSizeListResult, self).__init__(**kwargs) self.value = value @@ -13861,6 +17633,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -13899,6 +17673,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -13909,37 +17685,37 @@ class VirtualMachineUpdate(UpdateResource): 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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar 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_07_01.models.Plan - :param identity: The identity of the virtual machine, if configured. - :type identity: ~azure.mgmt.compute.v2021_07_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_07_01.models.HardwareProfile - :param storage_profile: Specifies the storage settings for the virtual machine disks. - :type storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile - :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + :vartype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the virtual machine. - :type additional_capabilities: ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities - :param os_profile: Specifies the operating system settings used while creating the virtual + :vartype additional_capabilities: ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :ivar 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_07_01.models.OSProfile - :param network_profile: Specifies the network interfaces of the virtual machine. - :type network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile - :param security_profile: Specifies the Security related profile settings for the virtual + :vartype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual machine. - :type security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile - :param diagnostics_profile: Specifies the boot diagnostic settings state. + :vartype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. - :type diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile - :param availability_set: Specifies information about the availability set that the virtual + :vartype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :ivar 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 `Availability sets overview @@ -13952,46 +17728,45 @@ class VirtualMachineUpdate(UpdateResource): 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_07_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 + :vartype availability_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_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: + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_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_07_01.models.VirtualMachinePriorityTypes - :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + :vartype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePriorityTypes + :ivar 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 + :vartype eviction_policy: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineEvictionPolicyTypes - :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :ivar 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_07_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_07_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. + :vartype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :ivar 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_07_01.models.SubResource + :vartype host_group: ~azure.mgmt.compute.v2021_07_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_07_01.models.VirtualMachineInstanceView - :param license_type: Specifies that the image or disk that is being used was licensed + :ivar 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: @@ -14001,16 +17776,16 @@ class VirtualMachineUpdate(UpdateResource): :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server `_ :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. - :type license_type: str + :vartype 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 + :ivar 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 + :vartype extensions_time_budget: str + :ivar 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' @@ -14018,18 +17793,20 @@ class VirtualMachineUpdate(UpdateResource): 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 scheduled_events_profile: Specifies Scheduled Event related configurations. - :type scheduled_events_profile: ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile - :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :ivar 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 - :param capacity_reservation: Specifies information about the capacity reservation that is used + :vartype user_data: str + :ivar capacity_reservation: Specifies information about the capacity reservation that is used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. - :type capacity_reservation: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile - :param application_profile: Specifies the gallery applications that should be made available to + :vartype capacity_reservation: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to the VM/VMSS. - :type application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile + :vartype application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile """ _validation = { @@ -14101,6 +17878,125 @@ def __init__( application_profile: Optional["ApplicationProfile"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword 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**. + :paramtype plan: ~azure.mgmt.compute.v2021_07_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2021_07_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2021_07_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2021_07_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2021_07_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2021_07_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2021_07_01.models.DiagnosticsProfile + :keyword 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 `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates 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. + :paramtype availability_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2021_07_01.models.VirtualMachinePriorityTypes + :keyword 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". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2021_07_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype host_group: ~azure.mgmt.compute.v2021_07_01.models.SubResource + :keyword 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. + :paramtype license_type: str + :keyword 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. + :paramtype extensions_time_budget: str + :keyword 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. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2021_07_01.models.ScheduledEventsProfile + :keyword 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. + :paramtype user_data: str + :keyword capacity_reservation: Specifies information about the capacity reservation that is + used to allocate virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2021-04-01. + :paramtype capacity_reservation: + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationProfile + :keyword application_profile: Specifies the gallery applications that should be made available + to the VM/VMSS. + :paramtype application_profile: ~azure.mgmt.compute.v2021_07_01.models.ApplicationProfile + """ super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) self.plan = plan self.identity = identity @@ -14137,17 +18033,17 @@ class VMGalleryApplication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. Optional, Specifies a passthrough value for more generic context. - :type tags: str - :param order: Optional, Specifies the order in which the packages have to be installed. - :type order: int - :param package_reference_id: Required. Specifies the GalleryApplicationVersion resource id on + :ivar tags: A set of tags. Optional, Specifies a passthrough value for more generic context. + :vartype tags: str + :ivar order: Optional, Specifies the order in which the packages have to be installed. + :vartype order: int + :ivar package_reference_id: Required. Specifies the GalleryApplicationVersion resource id on the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. - :type package_reference_id: str - :param configuration_reference: Optional, Specifies the uri to an azure blob that will replace + :vartype package_reference_id: str + :ivar configuration_reference: Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if provided. - :type configuration_reference: str + :vartype configuration_reference: str """ _validation = { @@ -14170,6 +18066,19 @@ def __init__( configuration_reference: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional, Specifies a passthrough value for more generic context. + :paramtype tags: str + :keyword order: Optional, Specifies the order in which the packages have to be installed. + :paramtype order: int + :keyword package_reference_id: Required. Specifies the GalleryApplicationVersion resource id on + the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + :paramtype package_reference_id: str + :keyword configuration_reference: Optional, Specifies the uri to an azure blob that will + replace the default configuration for the package if provided. + :paramtype configuration_reference: str + """ super(VMGalleryApplication, self).__init__(**kwargs) self.tags = tags self.order = order @@ -14180,11 +18089,11 @@ def __init__( class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): """VMScaleSetConvertToSinglePlacementGroupInput. - :param active_placement_group_id: Id of the placement group in which you want future virtual + :ivar 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 + :vartype active_placement_group_id: str """ _attribute_map = { @@ -14197,6 +18106,13 @@ def __init__( active_placement_group_id: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype active_placement_group_id: str + """ super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) self.active_placement_group_id = active_placement_group_id @@ -14204,20 +18120,19 @@ def __init__( class VMSizeProperties(msrest.serialization.Model): """Specifies VM Size Property settings on the virtual machine. - :param v_cpus_available: Specifies the number of vCPUs available for the VM. + :ivar v_cpus_available: Specifies the number of vCPUs available for the VM. :code:`
    `:code:`
    ` When this property is not specified in the request body the default behavior is to set it to the value of vCPUs available for that VM size exposed in api response of `List all available virtual machine sizes in a region `_ . - :type v_cpus_available: int - :param v_cpus_per_core: Specifies the vCPU to physical core ratio. :code:`
    `:code:`
    ` - When this property is not specified in the request body the default behavior is set to the - value of vCPUsPerCore for the VM Size exposed in api response of `List all available virtual - machine sizes in a region - `_ + :vartype v_cpus_available: int + :ivar v_cpus_per_core: Specifies the vCPU to physical core ratio. :code:`
    `:code:`
    ` When + this property is not specified in the request body the default behavior is set to the value of + vCPUsPerCore for the VM Size exposed in api response of `List all available virtual machine + sizes in a region `_ :code:`
    `:code:`
    ` Setting this property to 1 also means that hyper-threading is disabled. - :type v_cpus_per_core: int + :vartype v_cpus_per_core: int """ _attribute_map = { @@ -14232,6 +18147,22 @@ def __init__( v_cpus_per_core: Optional[int] = None, **kwargs ): + """ + :keyword v_cpus_available: Specifies the number of vCPUs available for the VM. + :code:`
    `:code:`
    ` When this property is not specified in the request body the default + behavior is to set it to the value of vCPUs available for that VM size exposed in api response + of `List all available virtual machine sizes in a region + `_ . + :paramtype v_cpus_available: int + :keyword v_cpus_per_core: Specifies the vCPU to physical core ratio. :code:`
    `:code:`
    ` + When this property is not specified in the request body the default behavior is set to the + value of vCPUsPerCore for the VM Size exposed in api response of `List all available virtual + machine sizes in a region + `_ + :code:`
    `:code:`
    ` Setting this property to 1 also means that hyper-threading is + disabled. + :paramtype v_cpus_per_core: int + """ super(VMSizeProperties, self).__init__(**kwargs) self.v_cpus_available = v_cpus_available self.v_cpus_per_core = v_cpus_per_core @@ -14240,31 +18171,31 @@ def __init__( 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 + :ivar 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 + :vartype provision_vm_agent: bool + :ivar 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". + :vartype enable_automatic_updates: bool + :ivar 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 + :vartype time_zone: str + :ivar 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: + :vartype additional_unattend_content: list[~azure.mgmt.compute.v2021_07_01.models.AdditionalUnattendContent] - :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on Windows. - :type patch_settings: ~azure.mgmt.compute.v2021_07_01.models.PatchSettings - :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + :vartype patch_settings: ~azure.mgmt.compute.v2021_07_01.models.PatchSettings + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - :type win_rm: ~azure.mgmt.compute.v2021_07_01.models.WinRMConfiguration + :vartype win_rm: ~azure.mgmt.compute.v2021_07_01.models.WinRMConfiguration """ _attribute_map = { @@ -14287,6 +18218,33 @@ def __init__( win_rm: Optional["WinRMConfiguration"] = None, **kwargs ): + """ + :keyword 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. + :paramtype provision_vm_agent: bool + :keyword 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. + :paramtype enable_automatic_updates: bool + :keyword 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 + `_. + :paramtype time_zone: str + :keyword 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. + :paramtype additional_unattend_content: + list[~azure.mgmt.compute.v2021_07_01.models.AdditionalUnattendContent] + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :paramtype patch_settings: ~azure.mgmt.compute.v2021_07_01.models.PatchSettings + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2021_07_01.models.WinRMConfiguration + """ super(WindowsConfiguration, self).__init__(**kwargs) self.provision_vm_agent = provision_vm_agent self.enable_automatic_updates = enable_automatic_updates @@ -14299,20 +18257,20 @@ def __init__( 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 + :ivar classifications_to_include: The update classifications to select when installing patches for Windows. - :type classifications_to_include: list[str or + :vartype classifications_to_include: list[str or ~azure.mgmt.compute.v2021_07_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 + :ivar kb_numbers_to_include: Kbs to include in the patch operation. + :vartype kb_numbers_to_include: list[str] + :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :vartype kb_numbers_to_exclude: list[str] + :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :type exclude_kbs_requiring_reboot: bool - :param max_patch_publish_date: This is used to install patches that were published on or before + :vartype exclude_kbs_requiring_reboot: bool + :ivar max_patch_publish_date: This is used to install patches that were published on or before this given max published date. - :type max_patch_publish_date: ~datetime.datetime + :vartype max_patch_publish_date: ~datetime.datetime """ _attribute_map = { @@ -14333,6 +18291,22 @@ def __init__( max_patch_publish_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Windows. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_07_01.models.VMGuestPatchClassificationWindows] + :keyword kb_numbers_to_include: Kbs to include in the patch operation. + :paramtype kb_numbers_to_include: list[str] + :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :paramtype kb_numbers_to_exclude: list[str] + :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :paramtype exclude_kbs_requiring_reboot: bool + :keyword max_patch_publish_date: This is used to install patches that were published on or + before this given max published date. + :paramtype max_patch_publish_date: ~datetime.datetime + """ super(WindowsParameters, self).__init__(**kwargs) self.classifications_to_include = classifications_to_include self.kb_numbers_to_include = kb_numbers_to_include @@ -14344,8 +18318,8 @@ def __init__( class WinRMConfiguration(msrest.serialization.Model): """Describes Windows Remote Management configuration of the VM. - :param listeners: The list of Windows Remote Management listeners. - :type listeners: list[~azure.mgmt.compute.v2021_07_01.models.WinRMListener] + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2021_07_01.models.WinRMListener] """ _attribute_map = { @@ -14358,6 +18332,10 @@ def __init__( listeners: Optional[List["WinRMListener"]] = None, **kwargs ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2021_07_01.models.WinRMListener] + """ super(WinRMConfiguration, self).__init__(**kwargs) self.listeners = listeners @@ -14365,11 +18343,11 @@ def __init__( 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 + :ivar 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_07_01.models.ProtocolTypes - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + :vartype protocol: str or ~azure.mgmt.compute.v2021_07_01.models.ProtocolTypes + :ivar 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 @@ -14380,7 +18358,7 @@ class WinRMListener(msrest.serialization.Model): Linux `_ or the `Azure Key Vault virtual machine extension for Windows `_. - :type certificate_url: str + :vartype certificate_url: str """ _attribute_map = { @@ -14395,6 +18373,24 @@ def __init__( certificate_url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :paramtype protocol: str or ~azure.mgmt.compute.v2021_07_01.models.ProtocolTypes + :keyword 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:`
    `} :code:`
    ` To install certificates on a + virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for + Linux `_ or the + `Azure Key Vault virtual machine extension for Windows + `_. + :paramtype certificate_url: str + """ 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_07_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_availability_sets_operations.py index f8785d221e70..0a59a5982507 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_availability_sets_operations.py @@ -5,23 +5,281 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -45,14 +303,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Create or update an availability set. :param resource_group_name: The name of the resource group. @@ -71,32 +329,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -110,16 +358,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - availability_set_name, # type: str - parameters, # type: "_models.AvailabilitySetUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs: Any + ) -> "_models.AvailabilitySet": """Update an availability set. :param resource_group_name: The name of the resource group. @@ -138,32 +388,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,15 +417,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> None: """Delete an availability set. :param resource_group_name: The name of the resource group. @@ -202,25 +444,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +467,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailabilitySet" + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> "_models.AvailabilitySet": """Retrieves information about an availability set. :param resource_group_name: The name of the resource group. @@ -256,27 +491,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,22 +515,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + expand: Optional[str] = None, + **kwargs: Any + ) -> 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_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -313,36 +542,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -360,24 +584,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_07_01.models.AvailabilitySetListResult] + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] @@ -385,35 +612,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,18 +654,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - availability_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @@ -451,8 +675,10 @@ def list_available_sizes( :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_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -460,36 +686,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py index 74de4b67fd15..13aa94191423 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py @@ -5,23 +5,260 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CapacityReservationGroupsOperations(object): """CapacityReservationGroupsOperations operations. @@ -45,14 +282,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - parameters, # type: "_models.CapacityReservationGroup" - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservationGroup" + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: "_models.CapacityReservationGroup", + **kwargs: Any + ) -> "_models.CapacityReservationGroup": """The operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. @@ -73,32 +310,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CapacityReservationGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroup') - 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 @@ -116,16 +343,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - parameters, # type: "_models.CapacityReservationGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservationGroup" + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: "_models.CapacityReservationGroupUpdate", + **kwargs: Any + ) -> "_models.CapacityReservationGroup": """The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. @@ -145,32 +374,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') - 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 @@ -184,15 +403,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + capacity_reservation_group_name: str, + **kwargs: Any + ) -> None: """The operation to delete a capacity reservation group. This operation is allowed only if all the associated resources are disassociated from the reservation group and all capacity reservations under the reservation group have also been deleted. Please refer to @@ -212,27 +433,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,14 +456,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - expand=None, # type: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservationGroup" + resource_group_name: str, + capacity_reservation_group_name: str, + expand: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.CapacityReservationGroup": """The operation that retrieves information about a capacity reservation group. :param resource_group_name: The name of the resource group. @@ -263,7 +475,8 @@ def get( the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservationGroup, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroup @@ -274,29 +487,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,15 +512,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapacityReservationGroupListResult"] + resource_group_name: str, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any + ) -> Iterable["_models.CapacityReservationGroupListResult"]: """Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the response to get the next page of capacity reservation groups. @@ -327,10 +531,13 @@ def list_by_resource_group( :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -338,37 +545,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -386,27 +589,31 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups'} # type: ignore + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapacityReservationGroupListResult"] + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any + ) -> Iterable["_models.CapacityReservationGroupListResult"]: """Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity reservation groups. :param expand: The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapacityReservationGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] + :return: An iterator like instance of either CapacityReservationGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] @@ -414,36 +621,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationGroupListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -461,6 +663,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py index 9ba716035455..061cc6a01d26 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py @@ -5,25 +5,233 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_capacity_reservation_group_request( + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "capacityReservationGroupName": _SERIALIZER.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CapacityReservationsOperations(object): """CapacityReservationsOperations operations. @@ -49,45 +257,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservation" - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservation" + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservation", + **kwargs: Any + ) -> "_models.CapacityReservation": cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservation') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservation') - 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 @@ -105,17 +302,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservation" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CapacityReservation"] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservation", + **kwargs: Any + ) -> LROPoller["_models.CapacityReservation"]: """The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. @@ -130,15 +329,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservation :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +355,21 @@ def begin_create_or_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +381,39 @@ def get_long_running_output(pipeline_response): ) 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservationUpdate" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CapacityReservation"] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservationUpdate", + **kwargs: Any + ) -> Optional["_models.CapacityReservation"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CapacityReservation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CapacityReservationUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CapacityReservationUpdate') - 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 @@ -242,17 +429,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - parameters, # type: "_models.CapacityReservationUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CapacityReservation"] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservationUpdate", + **kwargs: Any + ) -> LROPoller["_models.CapacityReservation"]: """The operation to update a capacity reservation. :param resource_group_name: The name of the resource group. @@ -265,15 +454,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CapacityReservation or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -286,28 +480,21 @@ def begin_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityReservation', 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -319,43 +506,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> 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-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_delete_request_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,14 +545,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more details. @@ -388,15 +566,17 @@ def begin_delete( :type capacity_reservation_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -411,22 +591,14 @@ def begin_delete( 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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -438,17 +610,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - capacity_reservation_name, # type: str - expand=None, # type: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityReservation" + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + expand: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.CapacityReservation": """The operation that retrieves information about the capacity reservation. :param resource_group_name: The name of the resource group. @@ -460,7 +633,8 @@ def get( :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. - :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationInstanceViewTypes + :type expand: str or + ~azure.mgmt.compute.v2021_07_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: CapacityReservation, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_07_01.models.CapacityReservation @@ -471,30 +645,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_group_name, 'str'), - 'capacityReservationName': self._serialize.url("capacity_reservation_name", capacity_reservation_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 = build_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -508,15 +671,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + + @distributed_trace def list_by_capacity_reservation_group( self, - resource_group_name, # type: str - capacity_reservation_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapacityReservationListResult"] + resource_group_name: str, + capacity_reservation_group_name: str, + **kwargs: Any + ) -> Iterable["_models.CapacityReservationListResult"]: """Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in the response to get the next page of capacity reservations. @@ -525,8 +690,10 @@ def list_by_capacity_reservation_group( :param capacity_reservation_group_name: The name of the capacity reservation group. :type capacity_reservation_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 CapacityReservationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationListResult] + :return: An iterator like instance of either CapacityReservationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] @@ -534,36 +701,33 @@ def list_by_capacity_reservation_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_capacity_reservation_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'capacityReservationGroupName': self._serialize.url("capacity_reservation_group_name", capacity_reservation_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) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_capacity_reservation_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityReservationListResult', pipeline_response) + deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -581,6 +745,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py index 16a13033a942..e83842f23440 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location: str, + public_gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CommunityGalleriesOperations(object): """CommunityGalleriesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - public_gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CommunityGallery" + location: str, + public_gallery_name: str, + **kwargs: Any + ) -> "_models.CommunityGallery": """Get a community gallery by gallery public name. :param location: Resource location. @@ -67,27 +104,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'publicGalleryName': self._serialize.url("public_gallery_name", public_gallery_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -101,4 +128,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py index 8a076425e5a3..2981f2073905 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py @@ -5,22 +5,63 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CommunityGalleryImageVersionsOperations(object): """CommunityGalleryImageVersionsOperations operations. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - public_gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CommunityGalleryImageVersion" + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> "_models.CommunityGalleryImageVersion": """Get a community gallery image version. :param location: Resource location. @@ -76,29 +117,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'publicGalleryName': self._serialize.url("public_gallery_name", public_gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -112,4 +143,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py index 653ad9145742..9447656ae5d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py @@ -5,22 +5,61 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CommunityGalleryImagesOperations(object): """CommunityGalleryImagesOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - public_gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CommunityGalleryImage" + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.CommunityGalleryImage": """Get a community gallery image. :param location: Resource location. @@ -70,28 +109,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'publicGalleryName': self._serialize.url("public_gallery_name", public_gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -105,4 +134,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py index dccc95da7350..98ab137ede06 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostGroupsOperations(object): """DedicatedHostGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs: Any + ) -> "_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). @@ -73,32 +296,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DedicatedHostGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_group_name, # type: str - parameters, # type: "_models.DedicatedHostGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DedicatedHostGroup" + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Update an dedicated host group. :param resource_group_name: The name of the resource group. @@ -144,32 +359,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -183,15 +388,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> None: """Delete a dedicated host group. :param resource_group_name: The name of the resource group. @@ -208,25 +415,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,14 +438,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.DedicatedHostGroup": """Retrieves information about a dedicated host group. :param resource_group_name: The name of the resource group. @@ -267,29 +467,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,22 +492,26 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -326,35 +519,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -372,22 +561,25 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + **kwargs: Any + ) -> 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_07_01.models.DedicatedHostGroupListResult] + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] @@ -395,34 +587,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -440,6 +627,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py index 1c9bac974eb7..45ffe9386de8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + host_group_name: str, + host_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "hostName": _SERIALIZER.url("host_name", host_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_host_group_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DedicatedHostsOperations(object): """DedicatedHostsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHost') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Create or update a dedicated host . :param resource_group_name: The name of the resource group. @@ -128,15 +321,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,28 +346,21 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -182,49 +372,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'DedicatedHostUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -238,17 +418,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> LROPoller["_models.DedicatedHost"]: """Update an dedicated host . :param resource_group_name: The name of the resource group. @@ -261,15 +443,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DedicatedHost or the result of cls(response) + :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_07_01.models.DedicatedHost] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +468,21 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,41 +494,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,14 +533,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - host_group_name, # type: str - host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a dedicated host. :param resource_group_name: The name of the resource group. @@ -380,15 +552,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +577,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,17 +596,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.DedicatedHost": """Retrieves information about a dedicated host. :param resource_group_name: The name of the resource group. @@ -463,30 +630,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,15 +656,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + @distributed_trace def list_by_host_group( self, - resource_group_name, # type: str - host_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DedicatedHostListResult"] + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> 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. @@ -517,8 +675,10 @@ def list_by_host_group( :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_07_01.models.DedicatedHostListResult] + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] @@ -526,36 +686,33 @@ def list_by_host_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_host_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -573,6 +730,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py index e9c66691d7a3..00698b6284d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py @@ -5,25 +5,254 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + select: Optional[Union[str, "_models.SelectPermissions"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleriesOperations(object): """GalleriesOperations operations. @@ -49,43 +278,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'Gallery') - 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 @@ -106,16 +324,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.Gallery" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Create or update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -127,15 +347,18 @@ def begin_create_or_update( :type gallery: ~azure.mgmt.compute.v2021_07_01.models.Gallery :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,27 +370,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -179,47 +396,37 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> "_models.Gallery": cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery, 'GalleryUpdate') - 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 @@ -233,16 +440,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery, # type: "_models.GalleryUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Gallery"] + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: """Update a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -254,15 +463,18 @@ def begin_update( :type gallery: ~azure.mgmt.compute.v2021_07_01.models.GalleryUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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 Gallery or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,27 +486,21 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Gallery', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -306,16 +512,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - select=None, # type: Optional[Union[str, "_models.SelectPermissions"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.Gallery" + resource_group_name: str, + gallery_name: str, + select: Optional[Union[str, "_models.SelectPermissions"]] = None, + **kwargs: Any + ) -> "_models.Gallery": """Retrieves information about a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -334,29 +541,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + select=select, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,41 +566,32 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> 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-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,13 +604,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Shared Image Gallery. :param resource_group_name: The name of the resource group. @@ -432,15 +620,17 @@ def begin_delete( :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -454,21 +644,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,14 +663,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a resource group. :param resource_group_name: The name of the resource group. @@ -502,35 +686,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -548,16 +728,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryList"] + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: """List galleries under a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -570,34 +751,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryList', pipeline_response) + deserialized = self._deserialize("GalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,6 +791,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py index edab37e5f88d..29db6b831dac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_application_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationVersionsOperations(object): """GalleryApplicationVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Create or update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -139,18 +348,24 @@ def begin_create_or_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the create or update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion + :type gallery_application_version: + ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +379,21 @@ def begin_create_or_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +405,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') - 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 @@ -256,18 +453,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - gallery_application_version, # type: "_models.GalleryApplicationVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplicationVersion"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: """Update a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -285,18 +484,24 @@ def begin_update( :type gallery_application_version_name: str :param gallery_application_version: Parameters supplied to the update gallery Application Version operation. - :type gallery_application_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionUpdate + :type gallery_application_version: + ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +515,21 @@ def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +541,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplicationVersion" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": """Retrieves information about a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -381,31 +579,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -419,45 +606,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> 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-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -470,15 +648,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application Version. :param resource_group_name: The name of the resource group. @@ -494,15 +673,17 @@ def begin_delete( :type gallery_application_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -518,23 +699,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - 'galleryApplicationVersionName': self._serialize.url("gallery_application_version_name", gallery_application_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -546,16 +718,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_application( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationVersionList"]: """List gallery Application Versions in a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -567,8 +740,10 @@ def list_by_gallery_application( Definition from which the Application Versions are to be listed. :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionList] + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] @@ -576,37 +751,35 @@ def list_by_gallery_application( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery_application.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationVersionList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -624,6 +797,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py index 921d01cc4e86..43bb19d8b781 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryApplicationsOperations(object): """GalleryApplicationsOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplication') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Create or update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -135,15 +330,20 @@ def begin_create_or_update( :type gallery_application: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -156,28 +356,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,49 +382,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> "_models.GalleryApplication": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') - 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 @@ -245,17 +428,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - gallery_application, # type: "_models.GalleryApplicationUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryApplication"] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: """Update a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -271,15 +456,20 @@ def begin_update( :type gallery_application: ~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryApplication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +482,21 @@ def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryApplication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,16 +508,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryApplication" + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> "_models.GalleryApplication": """Retrieves information about a gallery Application Definition. :param resource_group_name: The name of the resource group. @@ -355,28 +539,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,43 +564,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> 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-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -439,14 +604,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery Application. :param resource_group_name: The name of the resource group. @@ -458,15 +624,17 @@ def begin_delete( :type gallery_application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -481,22 +649,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryApplicationName': self._serialize.url("gallery_application_name", gallery_application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -508,15 +668,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryApplicationList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationList"]: """List gallery Application Definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -525,8 +686,10 @@ def list_by_gallery( Definitions are to be listed. :type gallery_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryApplicationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationList] + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] @@ -534,36 +697,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryApplicationList', pipeline_response) + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -581,6 +741,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py index baee0a78d36a..a440e286d719 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py @@ -5,25 +5,243 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_image_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImageVersionsOperations(object): """GalleryImageVersionsOperations operations. @@ -49,47 +267,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersion') - 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 @@ -110,18 +317,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersion" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Create or update a gallery image version. :param resource_group_name: The name of the resource group. @@ -142,15 +351,20 @@ def begin_create_or_update( :type gallery_image_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,29 +378,21 @@ def begin_create_or_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -198,51 +404,41 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryImageVersion": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') - 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 @@ -256,18 +452,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - gallery_image_version, # type: "_models.GalleryImageVersionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImageVersion"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: """Update a gallery image version. :param resource_group_name: The name of the resource group. @@ -288,15 +486,20 @@ def begin_update( :type gallery_image_version: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImageVersion or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] - :raises ~azure.core.exceptions.HttpResponseError: + :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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +513,21 @@ def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImageVersion', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,18 +539,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - expand=None, # type: Optional[Union[str, "_models.ReplicationStatusTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImageVersion" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": """Retrieves information about a gallery image version. :param resource_group_name: The name of the resource group. @@ -380,31 +576,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -418,45 +603,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> 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-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -469,15 +645,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image version. :param resource_group_name: The name of the resource group. @@ -492,15 +669,17 @@ def begin_delete( :type gallery_image_version_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -516,23 +695,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,16 +714,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + @distributed_trace def list_by_gallery_image( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageVersionList"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageVersionList"]: """List gallery image versions in a gallery image definition. :param resource_group_name: The name of the resource group. @@ -565,8 +736,10 @@ def list_by_gallery_image( Image Versions are to be listed. :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionList] + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] @@ -574,37 +747,35 @@ def list_by_gallery_image( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery_image.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -622,6 +793,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py index b9a2b21e8b12..547e7b2039da 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GalleryImagesOperations(object): """GalleryImagesOperations operations. @@ -49,45 +253,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') - 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 @@ -108,17 +301,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Create or update a gallery image definition. :param resource_group_name: The name of the resource group. @@ -134,15 +329,19 @@ def begin_create_or_update( :type gallery_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryImage :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,28 +354,21 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -188,49 +380,39 @@ def get_long_running_output(pipeline_response): ) 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> "_models.GalleryImage": cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageUpdate') - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GalleryImage"] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: """Update a gallery image definition. :param resource_group_name: The name of the resource group. @@ -270,15 +454,19 @@ def begin_update( :type gallery_image: ~azure.mgmt.compute.v2021_07_01.models.GalleryImageUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GalleryImage or the result of cls(response) + :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 GalleryImage or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +479,21 @@ def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GalleryImage', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,16 +505,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GalleryImage" + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": """Retrieves information about a gallery image definition. :param resource_group_name: The name of the resource group. @@ -353,28 +535,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,43 +560,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> 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-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,14 +600,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a gallery image. :param resource_group_name: The name of the resource group. @@ -456,15 +620,17 @@ def begin_delete( :type gallery_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,22 +645,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -506,15 +664,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + @distributed_trace def list_by_gallery( self, - resource_group_name, # type: str - gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GalleryImageList"] + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageList"]: """List gallery image definitions in a gallery. :param resource_group_name: The name of the resource group. @@ -532,36 +691,33 @@ def list_by_gallery( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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_gallery.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GalleryImageList', pipeline_response) + deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -579,6 +735,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py index 26c36521106a..2c94646422c3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py @@ -5,24 +5,71 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class GallerySharingProfileOperations(object): """GallerySharingProfileOperations operations. @@ -48,43 +95,32 @@ def __init__(self, client, config, serializer, deserializer): def _update_initial( self, - resource_group_name, # type: str - gallery_name, # type: str - sharing_update, # type: "_models.SharingUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.SharingUpdate" + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> "_models.SharingUpdate": cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(sharing_update, 'SharingUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sharing_update, 'SharingUpdate') - 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 @@ -102,16 +138,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - gallery_name, # type: str - sharing_update, # type: "_models.SharingUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SharingUpdate"] + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> LROPoller["_models.SharingUpdate"]: """Update sharing profile of a gallery. :param resource_group_name: The name of the resource group. @@ -122,15 +160,19 @@ def begin_update( :type sharing_update: ~azure.mgmt.compute.v2021_07_01.models.SharingUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SharingUpdate or the result of cls(response) + :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 SharingUpdate or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.SharingUpdate] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -142,27 +184,21 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, sharing_update=sharing_update, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SharingUpdate', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'galleryName': self._serialize.url("gallery_name", gallery_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -174,4 +210,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py index 4f037373b8f6..3171e1e92c68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py @@ -5,25 +5,248 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + image_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "imageName": _SERIALIZER.url("image_name", image_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImagesOperations(object): """ImagesOperations operations. @@ -49,43 +272,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'Image') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +315,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Create or update an image. :param resource_group_name: The name of the resource group. @@ -123,15 +337,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +360,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,47 +386,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -233,16 +434,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - image_name, # type: str - parameters, # type: "_models.ImageUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Image"] + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.Image"]: """Update an image. :param resource_group_name: The name of the resource group. @@ -253,15 +456,18 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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_07_01.models.Image] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +479,21 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -305,39 +505,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -350,13 +542,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Image. :param resource_group_name: The name of the resource group. @@ -365,15 +558,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,21 +582,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -413,16 +601,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get( self, - resource_group_name, # type: str - image_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Image" + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.Image": """Gets an image. :param resource_group_name: The name of the resource group. @@ -441,29 +630,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,14 +655,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: """Gets the list of images under a resource group. :param resource_group_name: The name of the resource group. @@ -499,35 +679,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,16 +721,17 @@ def get_next(next_link=None): 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 + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImageListResult"] + **kwargs: Any + ) -> 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. @@ -568,34 +745,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImageListResult', pipeline_response) + deserialized = self._deserialize("ImageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,6 +785,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py index 9493cd90ad2c..6eb901ec6565 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py @@ -5,24 +5,111 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_export_request_rate_by_interval_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_export_throttled_requests_request_initial( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -48,41 +135,30 @@ def __init__(self, client, config, serializer, deserializer): def _export_request_rate_by_interval_initial( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_request_rate_by_interval_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,15 +174,17 @@ def _export_request_rate_by_interval_initial( 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 + + @distributed_trace def begin_export_request_rate_by_interval( self, - location, # type: str - parameters, # type: "_models.RequestRateByIntervalInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. @@ -116,15 +194,20 @@ def begin_export_request_rate_by_interval( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +218,21 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,45 +244,35 @@ def get_long_running_output(pipeline_response): ) 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"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_throttled_requests_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,15 +288,17 @@ def _export_throttled_requests_initial( 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 + + @distributed_trace def begin_export_throttled_requests( self, - location, # type: str - parameters, # type: "_models.ThrottledRequestsInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> LROPoller["_models.LogAnalyticsOperationResult"]: """Export logs that show total throttled Api requests for this subscription in the given time window. @@ -238,15 +308,20 @@ def begin_export_throttled_requests( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,26 +332,21 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -288,4 +358,5 @@ def get_long_running_output(pipeline_response): ) 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_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py index 449d65f51fb9..fa5a49904547 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ComputeOperationListResult"] + **kwargs: Any + ) -> 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_07_01.models.ComputeOperationListResult] + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py index d37a24972b34..f7bc61bc5f23 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py @@ -5,23 +5,246 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "proximityPlacementGroupName": _SERIALIZER.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = _SERIALIZER.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProximityPlacementGroupsOperations(object): """ProximityPlacementGroupsOperations operations. @@ -45,14 +268,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Create or update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -71,32 +294,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProximityPlacementGroup') - # 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') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -114,16 +327,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - parameters, # type: "_models.ProximityPlacementGroupUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ProximityPlacementGroup" + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Update a proximity placement group. :param resource_group_name: The name of the resource group. @@ -142,32 +357,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + + request = build_update_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,15 +386,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - proximity_placement_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs: Any + ) -> None: """Delete a proximity placement group. :param resource_group_name: The name of the resource group. @@ -206,25 +413,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,14 +436,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.ProximityPlacementGroup": """Retrieves information about a proximity placement group . :param resource_group_name: The name of the resource group. @@ -264,29 +464,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, + subscription_id=self._config.subscription_id, + include_colocation_status=include_colocation_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,18 +489,22 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + **kwargs: Any + ) -> 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_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -319,34 +512,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,24 +552,27 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_07_01.models.ProximityPlacementGroupListResult] + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] @@ -389,35 +580,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,6 +622,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py index 79098e40c5c8..5666829e666c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py @@ -5,23 +5,63 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + include_extended_locations: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include_extended_locations is not None: + query_parameters['includeExtendedLocations'] = _SERIALIZER.query("include_extended_locations", include_extended_locations, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ResourceSkusOperations(object): """ResourceSkusOperations operations. @@ -45,13 +85,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - filter=None, # type: Optional[str] - include_extended_locations=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkusResult"] + filter: Optional[str] = None, + include_extended_locations: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceSkusResult"]: """Gets the list of Microsoft.Compute SKUs available for your Subscription. :param filter: The filter to apply on the operation. Only **location** filter is supported @@ -70,38 +110,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include_extended_locations is not None: - query_parameters['includeExtendedLocations'] = self._serialize.query("include_extended_locations", include_extended_locations, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + include_extended_locations=include_extended_locations, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,6 +154,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py index 0036c84702c6..775f82358931 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py @@ -5,25 +5,254 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + *, + expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RestorePointCollectionsOperations(object): """RestorePointCollectionsOperations operations. @@ -47,14 +276,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - parameters, # type: "_models.RestorePointCollection" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + parameters: "_models.RestorePointCollection", + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for more details. When updating a restore point collection, only tags may be modified. @@ -76,32 +305,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollection') - 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 @@ -119,16 +338,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - parameters, # type: "_models.RestorePointCollectionUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + parameters: "_models.RestorePointCollectionUpdate", + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to update the restore point collection. :param resource_group_name: The name of the resource group. @@ -147,32 +368,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePointCollectionUpdate') - 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 @@ -186,41 +397,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any + ) -> 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-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,13 +435,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the restore point collection. This operation will also delete all the contained restore points. @@ -249,15 +452,17 @@ def begin_delete( :type restore_point_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -271,21 +476,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -297,16 +495,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - expand=None, # type: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePointCollection" + resource_group_name: str, + restore_point_collection_name: str, + expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, + **kwargs: Any + ) -> "_models.RestorePointCollection": """The operation to get the restore point collection. :param resource_group_name: The name of the resource group. @@ -326,29 +525,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,21 +550,25 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorePointCollectionListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RestorePointCollectionListResult"]: """Gets the list of restore point collections 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 RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -384,35 +576,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,23 +618,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorePointCollectionListResult"] + **kwargs: Any + ) -> Iterable["_models.RestorePointCollectionListResult"]: """Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point collections. Do this till nextLink is not null to fetch all the restore point collections. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] + :return: An iterator like instance of either RestorePointCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] @@ -454,34 +645,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointCollectionListResult', pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,6 +685,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py index f834a110d1df..d211bb7c08ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py @@ -5,24 +5,147 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RestorePointsOperations(object): """RestorePointsOperations operations. @@ -48,45 +171,34 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - parameters, # type: "_models.RestorePoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: "_models.RestorePoint", + **kwargs: Any + ) -> "_models.RestorePoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'RestorePoint') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RestorePoint') - 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 @@ -100,17 +212,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - parameters, # type: "_models.RestorePoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RestorePoint"] + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: "_models.RestorePoint", + **kwargs: Any + ) -> LROPoller["_models.RestorePoint"]: """The operation to create the restore point. Updating properties of an existing restore point is not allowed. @@ -124,15 +238,19 @@ def begin_create( :type parameters: ~azure.mgmt.compute.v2021_07_01.models.RestorePoint :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RestorePoint or the result of cls(response) + :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 RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +263,21 @@ def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -178,43 +289,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> 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-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,14 +328,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the restore point. :param resource_group_name: The name of the resource group. @@ -245,15 +347,17 @@ def begin_delete( :type restore_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -268,22 +372,14 @@ def begin_delete( 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -295,16 +391,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - restore_point_collection_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePoint" + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> "_models.RestorePoint": """The operation to get the restore point. :param resource_group_name: The name of the resource group. @@ -323,28 +420,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'restorePointCollectionName': self._serialize.url("restore_point_collection_name", restore_point_collection_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,4 +445,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py index 6917433a7bf2..c786acad5486 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py @@ -5,23 +5,97 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharedGalleriesOperations(object): """SharedGalleriesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - shared_to=None, # type: Optional[Union[str, "_models.SharedToValues"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SharedGalleryList"] + location: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryList"]: """List shared galleries by subscription id or tenant id. :param location: Resource location. @@ -69,37 +143,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'location': self._serialize.url("location", location, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryList', pipeline_response) + deserialized = self._deserialize("SharedGalleryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,18 +187,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries'} # type: ignore + @distributed_trace def get( self, - location, # type: str - gallery_unique_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedGallery" + location: str, + gallery_unique_name: str, + **kwargs: Any + ) -> "_models.SharedGallery": """Get a shared gallery by subscription id or tenant id. :param location: Resource location. @@ -145,27 +216,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,4 +240,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py index 1297376e4300..8267b6dc6556 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py @@ -5,23 +5,105 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharedGalleryImageVersionsOperations(object): """SharedGalleryImageVersionsOperations operations. @@ -45,15 +127,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - gallery_unique_name, # type: str - gallery_image_name, # type: str - shared_to=None, # type: Optional[Union[str, "_models.SharedToValues"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SharedGalleryImageVersionList"] + location: str, + gallery_unique_name: str, + gallery_image_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryImageVersionList"]: """List shared gallery image versions by subscription id or tenant id. :param location: Resource location. @@ -67,8 +149,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2021_07_01.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersionList] + :return: An iterator like instance of either SharedGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] @@ -76,39 +160,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,20 +208,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions'} # type: ignore + @distributed_trace def get( self, - location, # type: str - gallery_unique_name, # type: str - gallery_image_name, # type: str - gallery_image_version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedGalleryImageVersion" + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImageVersion": """Get a shared gallery image version by subscription id or tenant id. :param location: Resource location. @@ -164,29 +247,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - 'galleryImageVersionName': self._serialize.url("gallery_image_version_name", gallery_image_version_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -200,4 +273,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py index 3c0c1ec4af7a..009f67a38b10 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py @@ -5,23 +5,101 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharedGalleryImagesOperations(object): """SharedGalleryImagesOperations operations. @@ -45,14 +123,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - gallery_unique_name, # type: str - shared_to=None, # type: Optional[Union[str, "_models.SharedToValues"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SharedGalleryImageList"] + location: str, + gallery_unique_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryImageList"]: """List shared gallery images by subscription id or tenant id. :param location: Resource location. @@ -63,8 +141,10 @@ def list( listing operations. :type shared_to: str or ~azure.mgmt.compute.v2021_07_01.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedGalleryImageList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageList] + :return: An iterator like instance of either SharedGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] @@ -72,38 +152,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, '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 shared_to is not None: - query_parameters['sharedTo'] = self._serialize.query("shared_to", shared_to, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedGalleryImageList', pipeline_response) + deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,19 +198,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images'} # type: ignore + @distributed_trace def get( self, - location, # type: str - gallery_unique_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedGalleryImage" + location: str, + gallery_unique_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImage": """Get a shared gallery image by subscription id or tenant id. :param location: Resource location. @@ -153,28 +231,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'galleryUniqueName': self._serialize.url("gallery_unique_name", gallery_unique_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, '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 = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,4 +256,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py index 1d7054a2c8ee..cccabd6476ea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py @@ -5,23 +5,277 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_key_pair_request( + resource_group_name: str, + ssh_public_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SshPublicKeysOperations(object): """SshPublicKeysOperations operations. @@ -45,17 +299,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + **kwargs: Any + ) -> 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_07_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -63,34 +319,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,25 +359,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_07_01.models.SshPublicKeysGroupListResult] + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] @@ -134,35 +388,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,19 +430,20 @@ def get_next(next_link=None): 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 + @distributed_trace def create( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Creates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -211,32 +462,22 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SshPublicKeyResource') + + request = build_create_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,16 +495,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - parameters, # type: "_models.SshPublicKeyUpdateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyUpdateResource", + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Updates a new SSH public key resource. :param resource_group_name: The name of the resource group. @@ -282,32 +525,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - # 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') + request = build_update_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -321,15 +554,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> None: """Delete an SSH public key. :param resource_group_name: The name of the resource group. @@ -346,25 +581,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_delete_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,13 +604,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyResource" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_models.SshPublicKeyResource": """Retrieves information about an SSH public key. :param resource_group_name: The name of the resource group. @@ -400,27 +628,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,15 +652,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + @distributed_trace def generate_key_pair( self, - resource_group_name, # type: str - ssh_public_key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SshPublicKeyGenerateKeyPairResult" + resource_group_name: str, + ssh_public_key_name: str, + **kwargs: Any + ) -> "_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. @@ -461,27 +681,17 @@ def generate_key_pair( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_generate_key_pair_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_key_pair.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,4 +705,6 @@ def generate_key_pair( 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_07_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_usage_operations.py index 3b4a0e776074..1342f68fcb1b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_usage_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsageOperations(object): """UsageOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListUsagesResult"] + location: str, + **kwargs: Any + ) -> 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. @@ -66,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListUsagesResult', pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py index bfe885ef1913..87110a272a0f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py @@ -5,22 +5,145 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_types_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "type": _SERIALIZER.url("type", type, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionImagesOperations(object): """VirtualMachineExtensionImagesOperations operations. @@ -44,15 +167,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - publisher_name, # type: str - type, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionImage" + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionImage": """Gets a virtual machine extension image. :param location: The name of a supported Azure region. @@ -73,29 +196,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,15 +222,17 @@ def get( 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 + + @distributed_trace def list_types( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineExtensionImage"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image types. :param location: The name of a supported Azure region. @@ -134,27 +249,17 @@ def list_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,19 +273,21 @@ def list_types( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: """Gets a list of virtual machine extension image versions. :param location: The name of a supported Azure region. @@ -205,34 +312,21 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,4 +340,6 @@ def list_versions( 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_07_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extensions_operations.py index 0f937ffa0bde..88735226ca2e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extensions_operations.py @@ -5,24 +5,230 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineExtensionsOperations(object): """VirtualMachineExtensionsOperations operations. @@ -48,45 +254,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,17 +299,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to create or update the extension. :param resource_group_name: The name of the resource group. @@ -129,15 +326,20 @@ def begin_create_or_update( :type extension_parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -150,28 +352,21 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,49 +378,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,17 +424,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineExtension"]: """The operation to update the extension. :param resource_group_name: The name of the resource group. @@ -260,18 +447,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +477,21 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,41 +503,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,14 +542,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - vm_extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -382,15 +561,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +586,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +605,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -463,30 +637,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,16 +663,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineExtensionsListResult" + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineExtensionsListResult": """The operation to get all extensions of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -528,29 +693,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,4 +718,6 @@ def list( 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_07_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_edge_zone_operations.py index 88f378aa8454..7fdd70192283 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -5,22 +5,229 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + edge_zone: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + edge_zone: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesEdgeZoneOperations(object): """VirtualMachineImagesEdgeZoneOperations operations. @@ -44,17 +251,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image in an edge zone. :param location: The name of a supported Azure region. @@ -79,31 +286,21 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + + request = build_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -117,21 +314,23 @@ def get( 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 + + @distributed_trace 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"] + 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: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. @@ -162,36 +361,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,16 +391,18 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - edge_zone, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + publisher_name: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image offers for the specified location, edge zone and publisher. @@ -234,28 +422,18 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -269,15 +447,17 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - edge_zone, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + edge_zone: str, + **kwargs: Any + ) -> 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. @@ -294,27 +474,17 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -328,17 +498,19 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + @distributed_trace 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"] + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. @@ -360,29 +532,19 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,4 +558,6 @@ def list_skus( 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_07_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py index ede3461589da..c019ae119d32 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py @@ -5,22 +5,219 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "skus": _SERIALIZER.url("skus", skus, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_offers_request( + location: str, + publisher_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_publishers_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + location: str, + publisher_name: str, + offer: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str'), + "offer": _SERIALIZER.url("offer", offer, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineImagesOperations(object): """VirtualMachineImagesOperations operations. @@ -44,16 +241,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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" + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs: Any + ) -> "_models.VirtualMachineImage": """Gets a virtual machine image. :param location: The name of a supported Azure region. @@ -76,30 +273,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -113,20 +300,22 @@ def get( 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 + + @distributed_trace 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"] + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: """Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. @@ -154,35 +343,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,15 +372,17 @@ def list( 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 + + @distributed_trace def list_offers( self, - location, # type: str - publisher_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + **kwargs: Any + ) -> 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. @@ -221,27 +399,17 @@ def list_offers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -255,14 +423,16 @@ def list_offers( 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 + + @distributed_trace def list_publishers( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + **kwargs: Any + ) -> 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. @@ -277,26 +447,16 @@ def list_publishers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,16 +470,18 @@ def list_publishers( return cls(pipeline_response, deserialized, {}) return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + @distributed_trace def list_skus( self, - location, # type: str - publisher_name, # type: str - offer, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.VirtualMachineImageResource"] + location: str, + publisher_name: str, + offer: str, + **kwargs: Any + ) -> 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. @@ -338,28 +500,18 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +525,6 @@ def list_skus( 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_07_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_run_commands_operations.py index 5bd6b395fa2e..3f3ba2002b02 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_run_commands_operations.py @@ -5,25 +5,305 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + location: str, + command_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_virtual_machine_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineRunCommandsOperations(object): """VirtualMachineRunCommandsOperations operations. @@ -47,19 +327,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunCommandListResult"] + location: str, + **kwargs: Any + ) -> 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_07_01.models.RunCommandListResult] + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] @@ -67,35 +349,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunCommandListResult', pipeline_response) + deserialized = self._deserialize("RunCommandListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,18 +391,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + @distributed_trace def get( self, - location, # type: str - command_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunCommandDocument" + location: str, + command_id: str, + **kwargs: Any + ) -> "_models.RunCommandDocument": """Gets specific run command for a subscription in a location. :param location: The location upon which run commands is queried. @@ -141,27 +420,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + location=location, + command_id=command_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,49 +444,40 @@ def get( 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -235,17 +495,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the run command. :param resource_group_name: The name of the resource group. @@ -259,15 +521,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +547,21 @@ def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,49 +573,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -369,17 +619,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the run command. :param resource_group_name: The name of the resource group. @@ -392,15 +644,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -413,28 +670,21 @@ def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,43 +696,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -495,14 +735,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vm_name, # type: str - run_command_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the run command. :param resource_group_name: The name of the resource group. @@ -513,15 +754,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -536,22 +779,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -563,17 +798,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the run command. :param resource_group_name: The name of the resource group. @@ -594,30 +830,19 @@ def get_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -631,16 +856,18 @@ def get_by_virtual_machine( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineRunCommandsListResult"]: """The operation to get all run commands of a Virtual Machine. :param resource_group_name: The name of the resource group. @@ -650,8 +877,10 @@ def list_by_virtual_machine( :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_07_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -659,38 +888,35 @@ def list_by_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -708,6 +934,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py index 8e93c335c4b9..b21caa10d78e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -5,25 +5,227 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetExtensionsOperations(object): """VirtualMachineScaleSetExtensionsOperations operations. @@ -49,45 +251,34 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,17 +296,19 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to create or update an extension. :param resource_group_name: The name of the resource group. @@ -127,18 +320,24 @@ def begin_create_or_update( :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_07_01.models.VirtualMachineScaleSetExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +350,21 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,49 +376,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -244,17 +426,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetExtension"]: """The operation to update an extension. :param resource_group_name: The name of the resource group. @@ -265,18 +449,24 @@ def begin_update( :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_07_01.models.VirtualMachineScaleSetExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -289,28 +479,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -322,41 +505,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +544,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the extension. :param resource_group_name: The name of the resource group. @@ -387,15 +563,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +588,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,17 +607,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetExtension": """The operation to get the extension. :param resource_group_name: The name of the resource group. @@ -468,30 +639,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +665,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"]: """Gets a list of all extensions in a VM scale set. :param resource_group_name: The name of the resource group. @@ -521,8 +683,10 @@ def list( :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_07_01.models.VirtualMachineScaleSetExtensionListResult] + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] @@ -530,36 +694,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -577,6 +738,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 7e479c0df746..d6df0c4f29e1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -5,24 +5,148 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_cancel_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_extension_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetRollingUpgradesOperations(object): """VirtualMachineScaleSetRollingUpgradesOperations operations. @@ -48,35 +172,26 @@ def __init__(self, client, config, serializer, deserializer): def _cancel_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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-07-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 = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,13 +204,14 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels the current virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -104,15 +220,17 @@ def begin_cancel( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,21 +244,14 @@ def begin_cancel( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -152,39 +263,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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-07-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 = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_os_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,13 +300,14 @@ def _start_os_upgrade_initial( _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_os_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -214,15 +318,17 @@ def begin_start_os_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -236,21 +342,14 @@ def begin_start_os_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,39 +361,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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-07-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 = build_start_extension_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self._start_extension_upgrade_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,13 +398,14 @@ def _start_extension_upgrade_initial( _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + @distributed_trace def begin_start_extension_upgrade( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -324,15 +416,17 @@ def begin_start_extension_upgrade( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,21 +440,14 @@ def begin_start_extension_upgrade( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,15 +459,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_latest( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RollingUpgradeStatusInfo" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.RollingUpgradeStatusInfo": """Gets the status of the latest virtual machine scale set rolling upgrade. :param resource_group_name: The name of the resource group. @@ -397,27 +485,17 @@ def get_latest( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_latest_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,4 +509,6 @@ def get_latest( 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_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 80979afd63f8..77612a2e60bb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -5,24 +5,246 @@ # 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 functools +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMExtensionsOperations(object): """VirtualMachineScaleSetVMExtensionsOperations operations. @@ -48,47 +270,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,18 +317,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to create or update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -130,18 +343,24 @@ def begin_create_or_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +374,21 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +400,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +448,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: """The operation to update the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -271,18 +474,24 @@ def begin_update( :type vm_extension_name: str :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension operation. - :type extension_parameters: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtensionUpdate + :type extension_parameters: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +505,21 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -330,45 +531,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,15 +572,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -402,15 +594,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,23 +620,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,18 +639,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMExtension": """The operation to get the VMSS VM extension. :param resource_group_name: The name of the resource group. @@ -488,31 +674,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,17 +701,19 @@ def get( 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 + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_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. @@ -557,30 +734,19 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,4 +760,6 @@ def list( 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_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 99a9df89223d..026a50d23f7f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -5,25 +5,247 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineScaleSetVMRunCommandsOperations(object): """VirtualMachineScaleSetVMRunCommandsOperations operations. @@ -49,47 +271,36 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') + + request = build_create_or_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -107,18 +318,20 @@ def _create_or_update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -133,15 +346,20 @@ def begin_create_or_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,29 +373,21 @@ def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -189,51 +399,41 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + + request = build_update_request_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, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,18 +447,20 @@ def _update_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -273,15 +475,20 @@ def begin_update( :type run_command: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,29 +502,21 @@ def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -329,45 +528,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_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, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,15 +569,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to delete the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -401,15 +591,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +617,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -453,18 +636,19 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.VirtualMachineRunCommand": """The operation to get the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -487,31 +671,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -525,17 +698,19 @@ def get( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -547,8 +722,10 @@ def list( :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_07_01.models.VirtualMachineRunCommandsListResult] + :return: An iterator like instance of either VirtualMachineRunCommandsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] @@ -556,39 +733,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -606,6 +781,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py index c8e8406a1d5c..903976976e7f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -5,25 +5,615 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualMachineScaleSetName": _SERIALIZER.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetVMsOperations(object): """VirtualMachineScaleSetVMsOperations operations. @@ -49,46 +639,37 @@ def __init__(self, client, config, serializer, deserializer): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +682,16 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -119,18 +701,22 @@ def begin_reimage( :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_07_01.models.VirtualMachineScaleSetVMReimageParameters + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -143,25 +729,18 @@ def begin_reimage( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,41 +752,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-07-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 = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,14 +791,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -239,15 +811,17 @@ def begin_reimage_all( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -262,22 +836,14 @@ def begin_reimage_all( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -289,41 +855,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-07-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 = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,14 +894,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -356,15 +915,17 @@ def begin_deallocate( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,22 +940,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,49 +959,39 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -466,17 +1009,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVM"]: """Updates a virtual machine of a VM scale set. :param resource_group_name: The name of the resource group. @@ -490,15 +1035,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,28 +1061,21 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -544,44 +1087,35 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,15 +1128,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -616,15 +1151,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -640,22 +1177,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -667,17 +1196,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVM": """Gets a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -700,30 +1230,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -737,16 +1256,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetVMInstanceView": """Gets the status of a virtual machine from a VM scale set. :param resource_group_name: The name of the resource group. @@ -765,28 +1286,18 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -800,18 +1311,20 @@ def get_instance_view( 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 + + @distributed_trace 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"] + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -828,8 +1341,10 @@ def list( '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_07_01.models.VirtualMachineScaleSetVMListResult] + :return: An iterator like instance of either VirtualMachineScaleSetVMListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] @@ -837,42 +1352,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -890,6 +1402,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -897,40 +1410,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -943,15 +1446,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -968,15 +1472,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -992,22 +1498,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1019,41 +1517,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1066,14 +1556,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1084,15 +1575,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1107,22 +1600,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1134,41 +1619,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1181,14 +1658,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1199,15 +1677,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1222,22 +1702,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1249,41 +1721,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1296,14 +1760,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. @@ -1315,15 +1780,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1338,22 +1805,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1365,17 +1824,18 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_models.RetrieveBootDiagnosticsDataResult": """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. @@ -1399,30 +1859,19 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1436,41 +1885,34 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1483,14 +1925,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Performs maintenance on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1501,15 +1944,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1524,22 +1969,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1551,16 +1988,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - instance_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> 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. @@ -1579,26 +2017,18 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1611,47 +2041,37 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1667,17 +2087,19 @@ def _run_command_initial( 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 + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1690,15 +2112,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1711,28 +2137,21 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1744,4 +2163,5 @@ def get_long_running_output(pipeline_response): ) 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_07_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_sets_operations.py index db6ad0c33031..823109fc2212 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_sets_operations.py @@ -5,25 +5,938 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_os_upgrade_history_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = _SERIALIZER.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_single_placement_group_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_set_orchestration_service_state_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachineScaleSetsOperations(object): """VirtualMachineScaleSetsOperations operations. @@ -47,19 +960,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + location: str, + **kwargs: Any + ) -> 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_07_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -67,35 +982,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +1024,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1032,32 @@ def get_next(next_link=None): 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') - # 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') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -174,16 +1075,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Create or update a VM scale set. :param resource_group_name: The name of the resource group. @@ -194,15 +1097,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,27 +1122,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -246,47 +1148,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -300,16 +1192,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSet"]: """Update a VM scale set. :param resource_group_name: The name of the resource group. @@ -320,15 +1214,20 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -340,27 +1239,21 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,42 +1265,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -420,14 +1304,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a VM scale set. :param resource_group_name: The name of the resource group. @@ -438,15 +1323,17 @@ def begin_delete( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -461,21 +1348,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -487,16 +1367,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSet": """Display information about a virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -517,29 +1398,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -553,48 +1423,41 @@ def get( 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -607,14 +1470,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -624,18 +1488,22 @@ def begin_deallocate( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -647,24 +1515,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -676,48 +1538,39 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-07-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) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_delete_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + force_deletion=force_deletion, + template_url=self._delete_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -730,15 +1583,16 @@ def _delete_instances_initial( _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -746,21 +1600,25 @@ def begin_delete_instances( :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_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -773,24 +1631,18 @@ def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -802,15 +1654,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_instance_view( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineScaleSetInstanceView": """Gets the status of a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -827,27 +1680,17 @@ def get_instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -861,21 +1704,25 @@ def get_instance_view( return cls(pipeline_response, deserialized, {}) return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_07_01.models.VirtualMachineScaleSetListResult] + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] @@ -883,35 +1730,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -929,23 +1772,26 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + **kwargs: Any + ) -> 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_07_01.models.VirtualMachineScaleSetListWithLinkResult] + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] @@ -953,34 +1799,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -998,18 +1839,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> 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. @@ -1018,8 +1860,10 @@ def list_skus( :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_07_01.models.VirtualMachineScaleSetListSkusResult] + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] @@ -1027,36 +1871,33 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1074,18 +1915,19 @@ def get_next(next_link=None): 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 + @distributed_trace def get_os_upgrade_history( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. @@ -1093,8 +1935,10 @@ def get_os_upgrade_history( :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_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] @@ -1102,36 +1946,33 @@ def get_os_upgrade_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=self.get_os_upgrade_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1149,6 +1990,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1156,47 +1998,37 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1209,15 +2041,16 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1231,18 +2064,22 @@ def begin_power_off( 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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1255,24 +2092,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1284,48 +2115,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1338,14 +2161,15 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1353,18 +2177,22 @@ def begin_restart( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1376,24 +2204,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1405,48 +2227,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1459,14 +2273,15 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Starts one or more virtual machines in a VM scale set. :param resource_group_name: The name of the resource group. @@ -1474,18 +2289,22 @@ def begin_start( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1497,24 +2316,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1526,48 +2339,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1580,14 +2385,15 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -1596,18 +2402,22 @@ def begin_redeploy( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1619,24 +2429,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1648,48 +2452,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1702,14 +2498,15 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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: @@ -1720,18 +2517,22 @@ def begin_perform_maintenance( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1743,24 +2544,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1772,45 +2567,37 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + + request = build_update_instances_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_instances_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1823,14 +2610,15 @@ def _update_instances_initial( _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> 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. @@ -1838,18 +2626,22 @@ def begin_update_instances( :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_07_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1861,24 +2653,18 @@ def begin_update_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1890,48 +2676,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1944,14 +2722,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1961,18 +2740,22 @@ def begin_reimage( :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_07_01.models.VirtualMachineScaleSetReimageParameters + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1984,24 +2767,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_scale_set_reimage_input=vm_scale_set_reimage_input, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2013,48 +2790,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2067,14 +2836,15 @@ def _reimage_all_initial( _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> 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. @@ -2083,18 +2853,22 @@ def begin_reimage_all( :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_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2106,24 +2880,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2135,16 +2903,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": """Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. @@ -2165,28 +2934,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + template_url=self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2200,16 +2959,18 @@ def force_recovery_service_fabric_platform_update_domain_walk( 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 + + @distributed_trace 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs: Any + ) -> None: """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. :param resource_group_name: The name of the resource group. @@ -2217,7 +2978,8 @@ def convert_to_single_placement_group( :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_07_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type parameters: + ~azure.mgmt.compute.v2021_07_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 @@ -2228,30 +2990,22 @@ def convert_to_single_placement_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.convert_to_single_placement_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2264,43 +3018,35 @@ def convert_to_single_placement_group( 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 + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._set_orchestration_service_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2313,14 +3059,15 @@ def _set_orchestration_service_state_initial( _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> LROPoller[None]: """Changes ServiceState property for a given service. :param resource_group_name: The name of the resource group. @@ -2331,15 +3078,18 @@ def begin_set_orchestration_service_state( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2351,24 +3101,18 @@ def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2380,4 +3124,5 @@ def get_long_running_output(pipeline_response): ) 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_07_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_sizes_operations.py index c51469cd55bc..44f2c1093e50 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_sizes_operations.py @@ -5,23 +5,58 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VirtualMachineSizesOperations(object): """VirtualMachineSizesOperations operations. @@ -45,20 +80,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + location: str, + **kwargs: Any + ) -> 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_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -66,35 +103,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py index ec6c497e4326..53d815d1ae9f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py @@ -5,25 +5,911 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_capture_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = _SERIALIZER.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_instance_view_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_convert_to_managed_disks_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + hibernate: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if hibernate is not None: + query_parameters['hibernate'] = _SERIALIZER.query("hibernate", hibernate, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_available_sizes_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_power_off_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = _SERIALIZER.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_retrieve_boot_diagnostics_data_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = _SERIALIZER.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_simulate_eviction_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_assess_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,19 +933,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + location: str, + **kwargs: Any + ) -> 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_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -67,35 +955,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,6 +997,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -120,43 +1005,32 @@ def get_next(next_link=None): def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - # 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') + request = build_capture_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._capture_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,16 +1046,18 @@ def _capture_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + @distributed_trace def begin_capture( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> 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. @@ -193,15 +1069,20 @@ def begin_capture( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineCaptureResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +1094,21 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,47 +1120,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'VirtualMachine') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -303,16 +1168,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. @@ -324,15 +1191,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -344,27 +1215,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,47 +1241,37 @@ def get_long_running_output(pipeline_response): ) 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" + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> "_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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VirtualMachineUpdate') - # 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') + request = build_update_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -430,16 +1285,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachine"] + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachine"]: """The operation to update a virtual machine. :param resource_group_name: The name of the resource group. @@ -450,15 +1307,19 @@ def begin_update( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of cls(response) + :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_07_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -470,27 +1331,21 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -502,42 +1357,33 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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-07-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 = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + force_deletion=force_deletion, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,34 +1396,36 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> 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). + :param force_deletion: Optional parameter to force delete virtual machines. :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -592,21 +1440,14 @@ def begin_delete( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -618,16 +1459,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any + ) -> "_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. @@ -649,29 +1491,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -685,15 +1516,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + @distributed_trace def instance_view( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineInstanceView" + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineInstanceView": """Retrieves information about the run-time state of a virtual machine. :param resource_group_name: The name of the resource group. @@ -710,27 +1543,17 @@ def instance_view( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_instance_view_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.instance_view.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -744,39 +1567,32 @@ def instance_view( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-07-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 = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._convert_to_managed_disks_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -789,13 +1605,14 @@ def _convert_to_managed_disks_initial( _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + @distributed_trace def begin_convert_to_managed_disks( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -805,15 +1622,17 @@ def begin_convert_to_managed_disks( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -827,21 +1646,14 @@ def begin_convert_to_managed_disks( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -853,42 +1665,33 @@ def get_long_running_output(pipeline_response): ) 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 - hibernate=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + hibernate: Optional[bool] = None, + **kwargs: Any + ) -> 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-07-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] - if hibernate is not None: - query_parameters['hibernate'] = self._serialize.query("hibernate", hibernate, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + hibernate=hibernate, + template_url=self._deallocate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -901,14 +1704,15 @@ def _deallocate_initial( _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + @distributed_trace def begin_deallocate( self, - resource_group_name, # type: str - vm_name, # type: str - hibernate=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + hibernate: Optional[bool] = None, + **kwargs: Any + ) -> 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. @@ -920,15 +1724,17 @@ def begin_deallocate( :type hibernate: bool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -943,21 +1749,14 @@ def begin_deallocate( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -969,15 +1768,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def generalize( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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 @@ -999,25 +1799,17 @@ def generalize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.generalize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1030,20 +1822,23 @@ def generalize( generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + resource_group_name: str, + **kwargs: Any + ) -> 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_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1051,35 +1846,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1097,17 +1888,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_all( self, - status_only=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineListResult"] + status_only: Optional[str] = None, + **kwargs: Any + ) -> 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. @@ -1115,8 +1907,10 @@ def list_all( 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_07_01.models.VirtualMachineListResult] + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] @@ -1124,36 +1918,31 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1171,18 +1960,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + @distributed_trace def list_available_sizes( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineSizeListResult"]: """Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -1191,8 +1981,10 @@ def list_available_sizes( :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_07_01.models.VirtualMachineSizeListResult] + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] @@ -1200,36 +1992,33 @@ def list_available_sizes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1247,6 +2036,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1254,38 +2044,28 @@ def get_next(next_link=None): 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 + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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-07-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 = build_power_off_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + template_url=self._power_off_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1298,14 +2078,15 @@ def _power_off_initial( _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> 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. @@ -1319,15 +2100,17 @@ def begin_power_off( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1342,21 +2125,14 @@ def begin_power_off( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1368,41 +2144,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-07-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 = build_reapply_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._reapply_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1415,13 +2181,14 @@ def _reapply_initial( _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + @distributed_trace def begin_reapply( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to reapply a virtual machine's state. :param resource_group_name: The name of the resource group. @@ -1430,15 +2197,17 @@ def begin_reapply( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1452,21 +2221,14 @@ def begin_reapply( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1478,39 +2240,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-07-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 = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1523,13 +2277,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to restart a virtual machine. :param resource_group_name: The name of the resource group. @@ -1538,15 +2293,17 @@ def begin_restart( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1560,21 +2317,14 @@ def begin_restart( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1586,39 +2336,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-07-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 = build_start_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1631,13 +2373,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to start a virtual machine. :param resource_group_name: The name of the resource group. @@ -1646,15 +2389,17 @@ def begin_start( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1668,21 +2413,14 @@ def begin_start( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1694,39 +2432,31 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-07-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 = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._redeploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1739,13 +2469,14 @@ def _redeploy_initial( _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + @distributed_trace def begin_redeploy( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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. @@ -1754,15 +2485,17 @@ def begin_redeploy( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1776,21 +2509,14 @@ def begin_redeploy( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1802,48 +2528,40 @@ def get_long_running_output(pipeline_response): ) 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 + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = 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) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1856,14 +2574,15 @@ def _reimage_initial( _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + @distributed_trace 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] + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> 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. @@ -1874,15 +2593,18 @@ def begin_reimage( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1894,24 +2616,18 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1923,16 +2639,17 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace 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" + resource_group_name: str, + vm_name: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> "_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. @@ -1953,29 +2670,18 @@ def retrieve_boot_diagnostics_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + template_url=self.retrieve_boot_diagnostics_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1989,39 +2695,32 @@ def retrieve_boot_diagnostics_data( 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 + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-07-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 = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._perform_maintenance_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2034,13 +2733,14 @@ def _perform_maintenance_initial( _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + @distributed_trace def begin_perform_maintenance( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller[None]: """The operation to perform maintenance on a virtual machine. :param resource_group_name: The name of the resource group. @@ -2049,15 +2749,17 @@ def begin_perform_maintenance( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2071,21 +2773,14 @@ def begin_perform_maintenance( 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) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2097,15 +2792,16 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def simulate_eviction( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """The operation to simulate the eviction of spot virtual machine. :param resource_group_name: The name of the resource group. @@ -2122,25 +2818,17 @@ def simulate_eviction( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-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 = build_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self.simulate_eviction.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2153,39 +2841,29 @@ def simulate_eviction( 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"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> 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-07-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 = build_assess_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + template_url=self._assess_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2201,15 +2879,17 @@ def _assess_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _assess_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + @distributed_trace def begin_assess_patches( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualMachineAssessPatchesResult"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineAssessPatchesResult"]: """Assess patches on the VM. :param resource_group_name: The name of the resource group. @@ -2218,15 +2898,19 @@ def begin_assess_patches( :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2240,24 +2924,17 @@ def begin_assess_patches( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2269,47 +2946,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - # 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') + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._install_patches_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2325,16 +2992,18 @@ def _install_patches_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _install_patches_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineInstallPatchesResult"]: """Installs patches on the VM. :param resource_group_name: The name of the resource group. @@ -2342,18 +3011,24 @@ def begin_install_patches( :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_07_01.models.VirtualMachineInstallPatchesParameters + :type install_patches_input: + ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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_07_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2365,27 +3040,21 @@ def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2397,47 +3066,37 @@ def get_long_running_output(pipeline_response): ) 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> 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-07-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RunCommandInput') - # 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') + request = build_run_command_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2453,16 +3112,18 @@ def _run_command_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + @distributed_trace 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"] + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2473,15 +3134,19 @@ def begin_run_command( :type parameters: ~azure.mgmt.compute.v2021_07_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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) + :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_07_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2493,27 +3158,21 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2525,4 +3184,5 @@ def get_long_running_output(pipeline_response): ) 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/__init__.py new file mode 100644 index 000000000000..fd39b8a6c901 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/__init__.py @@ -0,0 +1,18 @@ +# 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 ._compute_management_client import ComputeManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_compute_management_client.py new file mode 100644 index 000000000000..76bb0b85b41a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_compute_management_client.py @@ -0,0 +1,108 @@ +# 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 copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, SnapshotsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ComputeManagementClient: + """Compute Client. + + :ivar disks: DisksOperations operations + :vartype disks: azure.mgmt.compute.v2021_08_01.operations.DisksOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.compute.v2021_08_01.operations.SnapshotsOperations + :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2021_08_01.operations.DiskEncryptionSetsOperations + :ivar disk_accesses: DiskAccessesOperations operations + :vartype disk_accesses: azure.mgmt.compute.v2021_08_01.operations.DiskAccessesOperations + :ivar disk_restore_point: DiskRestorePointOperations operations + :vartype disk_restore_point: + azure.mgmt.compute.v2021_08_01.operations.DiskRestorePointOperations + :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. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ComputeManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_configuration.py new file mode 100644 index 000000000000..5145444f73ec --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_configuration.py @@ -0,0 +1,68 @@ +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ComputeManagementClientConfiguration(Configuration): + """Configuration for ComputeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-compute/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_metadata.json new file mode 100644 index 000000000000..4e15c5b50371 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_metadata.json @@ -0,0 +1,106 @@ +{ + "chosen_version": "2021-08-01", + "total_api_version_list": ["2021-08-01"], + "client": { + "name": "ComputeManagementClient", + "filename": "_compute_management_client", + "description": "Compute Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "disks": "DisksOperations", + "snapshots": "SnapshotsOperations", + "disk_encryption_sets": "DiskEncryptionSetsOperations", + "disk_accesses": "DiskAccessesOperations", + "disk_restore_point": "DiskRestorePointOperations" + } +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py new file mode 100644 index 000000000000..88e0f16a1883 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "24.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/__init__.py new file mode 100644 index 000000000000..9c044a7dd939 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/__init__.py @@ -0,0 +1,15 @@ +# 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 ._compute_management_client import ComputeManagementClient +__all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_compute_management_client.py new file mode 100644 index 000000000000..77438d0120ac --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_compute_management_client.py @@ -0,0 +1,105 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import DiskAccessesOperations, DiskEncryptionSetsOperations, DiskRestorePointOperations, DisksOperations, SnapshotsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ComputeManagementClient: + """Compute Client. + + :ivar disks: DisksOperations operations + :vartype disks: azure.mgmt.compute.v2021_08_01.aio.operations.DisksOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.compute.v2021_08_01.aio.operations.SnapshotsOperations + :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations + :vartype disk_encryption_sets: + azure.mgmt.compute.v2021_08_01.aio.operations.DiskEncryptionSetsOperations + :ivar disk_accesses: DiskAccessesOperations operations + :vartype disk_accesses: azure.mgmt.compute.v2021_08_01.aio.operations.DiskAccessesOperations + :ivar disk_restore_point: DiskRestorePointOperations operations + :vartype disk_restore_point: + azure.mgmt.compute.v2021_08_01.aio.operations.DiskRestorePointOperations + :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. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_encryption_sets = DiskEncryptionSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_accesses = DiskAccessesOperations(self._client, self._config, self._serialize, self._deserialize) + self.disk_restore_point = DiskRestorePointOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ComputeManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_configuration.py new file mode 100644 index 000000000000..e8b50952ba51 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ComputeManagementClientConfiguration(Configuration): + """Configuration for ComputeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-compute/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/__init__.py new file mode 100644 index 000000000000..c3e7f3bd4f2e --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._disks_operations import DisksOperations +from ._snapshots_operations import SnapshotsOperations +from ._disk_encryption_sets_operations import DiskEncryptionSetsOperations +from ._disk_accesses_operations import DiskAccessesOperations +from ._disk_restore_point_operations import DiskRestorePointOperations + +__all__ = [ + 'DisksOperations', + 'SnapshotsOperations', + 'DiskEncryptionSetsOperations', + 'DiskAccessesOperations', + 'DiskRestorePointOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_accesses_operations.py new file mode 100644 index 000000000000..64a061b76c9c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_accesses_operations.py @@ -0,0 +1,1000 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._disk_accesses_operations import build_create_or_update_request_initial, build_delete_a_private_endpoint_connection_request_initial, build_delete_request_initial, build_get_a_private_endpoint_connection_request, build_get_private_link_resources_request, build_get_request, build_list_by_resource_group_request, build_list_private_endpoint_connections_request, build_list_request, build_update_a_private_endpoint_connection_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiskAccessesOperations: + """DiskAccessesOperations 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_08_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, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> "_models.DiskAccess": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskAccess', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> AsyncLROPoller["_models.DiskAccess"]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + :type disk_access: ~azure.mgmt.compute.v2021_08_01.models.DiskAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + 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, + disk_access_name=disk_access_name, + disk_access=disk_access, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskAccess', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/diskAccesses/{diskAccessName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> "_models.DiskAccess": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskAccess', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.DiskAccess"]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :type disk_access: ~azure.mgmt.compute.v2021_08_01.models.DiskAccessUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + 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, + disk_access_name=disk_access_name, + disk_access=disk_access, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskAccess', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.DiskAccess": + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskAccess, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.DiskAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/diskAccesses/{diskAccessName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + disk_access_name=disk_access_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DiskAccessList"]: + """Lists all the disk access resources 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 DiskAccessList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", 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/diskAccesses'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DiskAccessList"]: + """Lists all the disk access resources under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskAccessList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", 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/diskAccesses'} # type: ignore + + @distributed_trace_async + async def get_private_link_resources( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": + """Gets the private link resources possible under disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + + + async def _update_a_private_endpoint_connection_initial( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update_a_private_endpoint_connection( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. + :type private_endpoint_connection: + ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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_a_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async + async def get_a_private_endpoint_connection( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets information about a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + async def _delete_a_private_endpoint_connection_initial( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete_a_private_endpoint_connection( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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_a_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace + def list_private_endpoint_connections( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """List information about private endpoint connections under a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", 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_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_encryption_sets_operations.py new file mode 100644 index 000000000000..c516145cad1f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_encryption_sets_operations.py @@ -0,0 +1,659 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._disk_encryption_sets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_associated_resources_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiskEncryptionSetsOperations: + """DiskEncryptionSetsOperations 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_08_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, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskEncryptionSet', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> AsyncLROPoller["_models.DiskEncryptionSet"]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + 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, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskEncryptionSet', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.DiskEncryptionSet"]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + 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, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": + """Gets information about a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskEncryptionSet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskEncryptionSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + disk_encryption_set_name=disk_encryption_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DiskEncryptionSetList"]: + """Lists all the disk encryption 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 DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", 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/diskEncryptionSets'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DiskEncryptionSetList"]: + """Lists all the disk encryption sets under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", 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/diskEncryptionSets'} # type: ignore + + @distributed_trace + def list_associated_resources( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceUriList"]: + """Lists all resources that are encrypted with this disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_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 ResourceUriList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.ResourceUriList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceUriList", 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_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_restore_point_operations.py new file mode 100644 index 000000000000..f413b06e9a0a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_restore_point_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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._disk_restore_point_operations import build_get_request, build_grant_access_request_initial, build_list_by_restore_point_request, build_revoke_access_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiskRestorePointOperations: + """DiskRestorePointOperations 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_08_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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> "_models.DiskRestorePoint": + """Get disk restorePoint resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the disk restore point created. + :type disk_restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskRestorePoint, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.DiskRestorePoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskRestorePoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + + @distributed_trace + def list_by_restore_point( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DiskRestorePointList"]: + """Lists diskRestorePoints under a vmRestorePoint. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskRestorePointList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskRestorePointList", 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_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + + async def _grant_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('AccessUri', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + + @distributed_trace_async + async def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> AsyncLROPoller["_models.AccessUri"]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the disk restore point created. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. + :type grant_access_data: ~azure.mgmt.compute.v2021_08_01.models.GrantAccessData + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] + 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._grant_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AccessUri', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + async def _revoke_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + + + @distributed_trace_async + async def begin_revoke_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Revokes access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the disk restore point created. + :type disk_restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._revoke_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disks_operations.py new file mode 100644 index 000000000000..a853314f5192 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disks_operations.py @@ -0,0 +1,794 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._disks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DisksOperations: + """DisksOperations 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_08_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, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Disk', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Disk', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> AsyncLROPoller["_models.Disk"]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. + :type disk: ~azure.mgmt.compute.v2021_08_01.models.Disk + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + 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, + disk_name=disk_name, + disk=disk, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Disk', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/disks/{diskName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Disk', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Disk', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.Disk"]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. + :type disk: ~azure.mgmt.compute.v2021_08_01.models.DiskUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + 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, + disk_name=disk_name, + disk=disk, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Disk', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/disks/{diskName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": + """Gets information about a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Disk, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.Disk + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Disk', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/disks/{diskName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + disk_name=disk_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/disks/{diskName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DiskList"]: + """Lists all the disks 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 DiskList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskList", 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/disks'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DiskList"]: + """Lists all the disks under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskList", 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/disks'} # type: ignore + + async def _grant_access_initial( + self, + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('AccessUri', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + + @distributed_trace_async + async def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> AsyncLROPoller["_models.AccessUri"]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. + :type grant_access_data: ~azure.mgmt.compute.v2021_08_01.models.GrantAccessData + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] + 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._grant_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AccessUri', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + async def _revoke_access_initial( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + + @distributed_trace_async + async def begin_revoke_access( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Revokes access to a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._revoke_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_snapshots_operations.py new file mode 100644 index 000000000000..51e77ee74861 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_snapshots_operations.py @@ -0,0 +1,796 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_grant_access_request_initial, build_list_by_resource_group_request, build_list_request, build_revoke_access_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SnapshotsOperations: + """SnapshotsOperations 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_08_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, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Snapshot', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> AsyncLROPoller["_models.Snapshot"]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. + :type snapshot: ~azure.mgmt.compute.v2021_08_01.models.Snapshot + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + 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, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Snapshot', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/snapshots/{snapshotName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Snapshot', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.Snapshot"]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + :type snapshot: ~azure.mgmt.compute.v2021_08_01.models.SnapshotUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + 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, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Snapshot', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": + """Gets information about a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/snapshots/{snapshotName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + snapshot_name=snapshot_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SnapshotList"]: + """Lists snapshots 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 SnapshotList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotList", 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/snapshots'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SnapshotList"]: + """Lists snapshots under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotList", 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/snapshots'} # type: ignore + + async def _grant_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('AccessUri', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + + @distributed_trace_async + async def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> AsyncLROPoller["_models.AccessUri"]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. + :type grant_access_data: ~azure.mgmt.compute.v2021_08_01.models.GrantAccessData + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] + 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._grant_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AccessUri', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + async def _revoke_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + + @distributed_trace_async + async def begin_revoke_access( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Revokes access to a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._revoke_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/__init__.py new file mode 100644 index 000000000000..d3a120e354e8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/__init__.py @@ -0,0 +1,139 @@ +# 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 ._models_py3 import AccessUri +from ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import CreationData +from ._models_py3 import Disk +from ._models_py3 import DiskAccess +from ._models_py3 import DiskAccessList +from ._models_py3 import DiskAccessUpdate +from ._models_py3 import DiskEncryptionSet +from ._models_py3 import DiskEncryptionSetList +from ._models_py3 import DiskEncryptionSetUpdate +from ._models_py3 import DiskList +from ._models_py3 import DiskRestorePoint +from ._models_py3 import DiskRestorePointList +from ._models_py3 import DiskSecurityProfile +from ._models_py3 import DiskSku +from ._models_py3 import DiskUpdate +from ._models_py3 import Encryption +from ._models_py3 import EncryptionSetIdentity +from ._models_py3 import EncryptionSettingsCollection +from ._models_py3 import EncryptionSettingsElement +from ._models_py3 import ExtendedLocation +from ._models_py3 import GrantAccessData +from ._models_py3 import ImageDiskReference +from ._models_py3 import InnerError +from ._models_py3 import KeyForDiskEncryptionSet +from ._models_py3 import KeyVaultAndKeyReference +from ._models_py3 import KeyVaultAndSecretReference +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import PropertyUpdatesInProgress +from ._models_py3 import ProxyOnlyResource +from ._models_py3 import PurchasePlan +from ._models_py3 import Resource +from ._models_py3 import ResourceUriList +from ._models_py3 import ShareInfoElement +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotList +from ._models_py3 import SnapshotSku +from ._models_py3 import SnapshotUpdate +from ._models_py3 import SourceVault +from ._models_py3 import SupportedCapabilities + + +from ._compute_management_client_enums import ( + AccessLevel, + DiskCreateOption, + DiskEncryptionSetIdentityType, + DiskEncryptionSetType, + DiskSecurityTypes, + DiskState, + DiskStorageAccountTypes, + EncryptionType, + ExtendedLocationTypes, + HyperVGeneration, + NetworkAccessPolicy, + OperatingSystemTypes, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + PublicNetworkAccess, + SnapshotStorageAccountTypes, +) + +__all__ = [ + 'AccessUri', + 'ApiError', + 'ApiErrorBase', + 'CreationData', + 'Disk', + 'DiskAccess', + 'DiskAccessList', + 'DiskAccessUpdate', + 'DiskEncryptionSet', + 'DiskEncryptionSetList', + 'DiskEncryptionSetUpdate', + 'DiskList', + 'DiskRestorePoint', + 'DiskRestorePointList', + 'DiskSecurityProfile', + 'DiskSku', + 'DiskUpdate', + 'Encryption', + 'EncryptionSetIdentity', + 'EncryptionSettingsCollection', + 'EncryptionSettingsElement', + 'ExtendedLocation', + 'GrantAccessData', + 'ImageDiskReference', + 'InnerError', + 'KeyForDiskEncryptionSet', + 'KeyVaultAndKeyReference', + 'KeyVaultAndSecretReference', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'PropertyUpdatesInProgress', + 'ProxyOnlyResource', + 'PurchasePlan', + 'Resource', + 'ResourceUriList', + 'ShareInfoElement', + 'Snapshot', + 'SnapshotList', + 'SnapshotSku', + 'SnapshotUpdate', + 'SourceVault', + 'SupportedCapabilities', + 'AccessLevel', + 'DiskCreateOption', + 'DiskEncryptionSetIdentityType', + 'DiskEncryptionSetType', + 'DiskSecurityTypes', + 'DiskState', + 'DiskStorageAccountTypes', + 'EncryptionType', + 'ExtendedLocationTypes', + 'HyperVGeneration', + 'NetworkAccessPolicy', + 'OperatingSystemTypes', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'PublicNetworkAccess', + 'SnapshotStorageAccountTypes', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/_compute_management_client_enums.py new file mode 100644 index 000000000000..17a26864da82 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/_compute_management_client_enums.py @@ -0,0 +1,218 @@ +# 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 enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + NONE = "None" + READ = "Read" + WRITE = "Write" + +class DiskCreateOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This enumerates the possible sources of a disk's creation. + """ + + #: Create an empty data disk of a size given by diskSizeGB. + EMPTY = "Empty" + #: Disk will be attached to a VM. + ATTACH = "Attach" + #: Create a new disk from a platform image specified by the given imageReference or + #: galleryImageReference. + FROM_IMAGE = "FromImage" + #: Create a disk by importing from a blob specified by a sourceUri in a storage account specified + #: by storageAccountId. + IMPORT_ENUM = "Import" + #: Create a new disk or snapshot by copying from a disk or snapshot specified by the given + #: sourceResourceId. + COPY = "Copy" + #: Create a new disk by copying from a backup recovery point. + RESTORE = "Restore" + #: Create a new disk by obtaining a write token and using it to directly upload the contents of + #: the disk. + UPLOAD = "Upload" + #: Create a new disk by using a deep copy process, where the resource creation is considered + #: complete only after all data has been copied from the source. + COPY_START = "CopyStart" + #: Similar to Import create option. Create a new Trusted Launch VM or Confidential VM supported + #: disk by importing additional blob for VM guest state specified by securityDataUri in storage + #: account specified by storageAccountId. + IMPORT_SECURE = "ImportSecure" + #: Similar to Upload create option. Create a new Trusted Launch VM or Confidential VM supported + #: disk and upload using write token in both disk and VM guest state. + UPLOAD_PREPARED_SECURE = "UploadPreparedSecure" + +class DiskEncryptionSetIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported + for new creations. Disk Encryption Sets can be updated with Identity type None during migration + of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources + to lose access to the keys. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + NONE = "None" + +class DiskEncryptionSetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of key used to encrypt the data of the disk. + """ + + #: Resource using diskEncryptionSet would be encrypted at rest with Customer managed key that can + #: be changed and revoked by a customer. + ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY = "EncryptionAtRestWithCustomerKey" + #: Resource using diskEncryptionSet would be encrypted at rest with two layers of encryption. One + #: of the keys is Customer managed and the other key is Platform managed. + ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" + #: Confidential VM supported disk and VM guest state would be encrypted with customer managed key. + CONFIDENTIAL_VM_ENCRYPTED_WITH_CUSTOMER_KEY = "ConfidentialVmEncryptedWithCustomerKey" + +class DiskSecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the SecurityType of the VM. Applicable for OS disks only. + """ + + #: Trusted Launch provides security features such as secure boot and virtual Trusted Platform + #: Module (vTPM). + TRUSTED_LAUNCH = "TrustedLaunch" + #: Indicates Confidential VM disk with only VM guest state encrypted. + CONFIDENTIAL_VM_VMGUEST_STATE_ONLY_ENCRYPTED_WITH_PLATFORM_KEY = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey" + #: Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a platform + #: managed key. + CONFIDENTIAL_VM_DISK_ENCRYPTED_WITH_PLATFORM_KEY = "ConfidentialVM_DiskEncryptedWithPlatformKey" + #: Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a customer + #: managed key. + CONFIDENTIAL_VM_DISK_ENCRYPTED_WITH_CUSTOMER_KEY = "ConfidentialVM_DiskEncryptedWithCustomerKey" + +class DiskState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This enumerates the possible state of the disk. + """ + + #: The disk is not being used and can be attached to a VM. + UNATTACHED = "Unattached" + #: The disk is currently attached to a running VM. + ATTACHED = "Attached" + #: The disk is attached to a stopped-deallocated VM. + RESERVED = "Reserved" + #: The disk is attached to a VM which is in hibernated state. + FROZEN = "Frozen" + #: The disk currently has an Active SAS Uri associated with it. + ACTIVE_SAS = "ActiveSAS" + #: The disk is attached to a VM in hibernated state and has an active SAS URI associated with it. + ACTIVE_SAS_FROZEN = "ActiveSASFrozen" + #: A disk is ready to be created by upload by requesting a write token. + READY_TO_UPLOAD = "ReadyToUpload" + #: A disk is created for upload and a write token has been issued for uploading to it. + ACTIVE_UPLOAD = "ActiveUpload" + +class DiskStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The sku name. + """ + + #: Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access. + STANDARD_LRS = "Standard_LRS" + #: Premium SSD locally redundant storage. Best for production and performance sensitive workloads. + PREMIUM_LRS = "Premium_LRS" + #: Standard SSD locally redundant storage. Best for web servers, lightly used enterprise + #: applications and dev/test. + STANDARD_SSD_LRS = "StandardSSD_LRS" + #: Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top tier + #: databases (for example, SQL, Oracle), and other transaction-heavy workloads. + ULTRA_SSD_LRS = "UltraSSD_LRS" + #: Premium SSD zone redundant storage. Best for the production workloads that need storage + #: resiliency against zone failures. + PREMIUM_ZRS = "Premium_ZRS" + #: Standard SSD zone redundant storage. Best for web servers, lightly used enterprise applications + #: and dev/test that need storage resiliency against zone failures. + STANDARD_SSD_ZRS = "StandardSSD_ZRS" + +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of key used to encrypt the data of the disk. + """ + + #: Disk is encrypted at rest with Platform managed key. It is the default encryption type. This is + #: not a valid encryption type for disk encryption sets. + ENCRYPTION_AT_REST_WITH_PLATFORM_KEY = "EncryptionAtRestWithPlatformKey" + #: Disk is encrypted at rest with Customer managed key that can be changed and revoked by a + #: customer. + ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY = "EncryptionAtRestWithCustomerKey" + #: Disk is encrypted at rest with 2 layers of encryption. One of the keys is Customer managed and + #: the other key is Platform managed. + ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = "EncryptionAtRestWithPlatformAndCustomerKeys" + +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of extendedLocation. + """ + + EDGE_ZONE = "EdgeZone" + +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + """ + + V1 = "V1" + V2 = "V2" + +class NetworkAccessPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Policy for accessing the disk via network. + """ + + #: The disk can be exported or uploaded to from any network. + ALLOW_ALL = "AllowAll" + #: The disk can be exported or uploaded to using a DiskAccess resource's private endpoints. + ALLOW_PRIVATE = "AllowPrivate" + #: The disk cannot be exported. + DENY_ALL = "DenyAll" + +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The Operating System type. + """ + + WINDOWS = "Windows" + LINUX = "Linux" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Policy for controlling export on the disk. + """ + + #: You can generate a SAS URI to access the underlying data of the disk publicly on the internet + #: when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from + #: your trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. + ENABLED = "Enabled" + #: You cannot access the underlying data of the disk publicly on the internet even when + #: NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your + #: trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. + DISABLED = "Disabled" + +class SnapshotStorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The sku name. + """ + + #: Standard HDD locally redundant storage. + STANDARD_LRS = "Standard_LRS" + #: Premium SSD locally redundant storage. + PREMIUM_LRS = "Premium_LRS" + #: Standard zone redundant storage. + STANDARD_ZRS = "Standard_ZRS" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/_models_py3.py new file mode 100644 index 000000000000..b05f3a6fc1e4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/models/_models_py3.py @@ -0,0 +1,2887 @@ +# 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 Dict, List, Optional, Union + +import msrest.serialization + +from ._compute_management_client_enums import * + + +class AccessUri(msrest.serialization.Model): + """A disk access SAS uri. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar access_sas: A SAS uri for accessing a disk. + :vartype access_sas: str + :ivar security_data_access_sas: A SAS uri for accessing a VM guest state. + :vartype security_data_access_sas: str + """ + + _validation = { + 'access_sas': {'readonly': True}, + 'security_data_access_sas': {'readonly': True}, + } + + _attribute_map = { + 'access_sas': {'key': 'accessSAS', 'type': 'str'}, + 'security_data_access_sas': {'key': 'securityDataAccessSAS', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AccessUri, self).__init__(**kwargs) + self.access_sas = None + self.security_data_access_sas = None + + +class ApiError(msrest.serialization.Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2021_08_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2021_08_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["ApiErrorBase"]] = None, + innererror: Optional["InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2021_08_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2021_08_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiError, self).__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.target = target + self.message = message + + +class ApiErrorBase(msrest.serialization.Model): + """Api error base. + + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiErrorBase, self).__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class CreationData(msrest.serialization.Model): + """Data used when creating a 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. + + :ivar create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", + "CopyStart", "ImportSecure", "UploadPreparedSecure". + :vartype create_option: str or ~azure.mgmt.compute.v2021_08_01.models.DiskCreateOption + :ivar storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :vartype storage_account_id: str + :ivar image_reference: Disk source information. + :vartype image_reference: ~azure.mgmt.compute.v2021_08_01.models.ImageDiskReference + :ivar gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :vartype gallery_image_reference: ~azure.mgmt.compute.v2021_08_01.models.ImageDiskReference + :ivar source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :vartype source_uri: str + :ivar source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot or + disk. + :vartype source_resource_id: str + :ivar source_unique_id: If this field is set, this is the unique id identifying the source of + this resource. + :vartype source_unique_id: str + :ivar upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :vartype upload_size_bytes: long + :ivar logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values are + 512 ad 4096. 4096 is the default. + :vartype logical_sector_size: int + :ivar security_data_uri: If createOption is ImportSecure, this is the URI of a blob to be + imported into VM guest state. + :vartype security_data_uri: str + """ + + _validation = { + 'create_option': {'required': True}, + 'source_unique_id': {'readonly': True}, + } + + _attribute_map = { + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, + 'gallery_image_reference': {'key': 'galleryImageReference', 'type': 'ImageDiskReference'}, + 'source_uri': {'key': 'sourceUri', 'type': 'str'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, + 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, + 'logical_sector_size': {'key': 'logicalSectorSize', 'type': 'int'}, + 'security_data_uri': {'key': 'securityDataUri', 'type': 'str'}, + } + + def __init__( + self, + *, + create_option: Union[str, "DiskCreateOption"], + storage_account_id: Optional[str] = None, + image_reference: Optional["ImageDiskReference"] = None, + gallery_image_reference: Optional["ImageDiskReference"] = None, + source_uri: Optional[str] = None, + source_resource_id: Optional[str] = None, + upload_size_bytes: Optional[int] = None, + logical_sector_size: Optional[int] = None, + security_data_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword create_option: Required. This enumerates the possible sources of a disk's creation. + Possible values include: "Empty", "Attach", "FromImage", "Import", "Copy", "Restore", "Upload", + "CopyStart", "ImportSecure", "UploadPreparedSecure". + :paramtype create_option: str or ~azure.mgmt.compute.v2021_08_01.models.DiskCreateOption + :keyword storage_account_id: Required if createOption is Import. The Azure Resource Manager + identifier of the storage account containing the blob to import as a disk. + :paramtype storage_account_id: str + :keyword image_reference: Disk source information. + :paramtype image_reference: ~azure.mgmt.compute.v2021_08_01.models.ImageDiskReference + :keyword gallery_image_reference: Required if creating from a Gallery Image. The id of the + ImageDiskReference will be the ARM id of the shared galley image version from which to create a + disk. + :paramtype gallery_image_reference: ~azure.mgmt.compute.v2021_08_01.models.ImageDiskReference + :keyword source_uri: If createOption is Import, this is the URI of a blob to be imported into a + managed disk. + :paramtype source_uri: str + :keyword source_resource_id: If createOption is Copy, this is the ARM id of the source snapshot + or disk. + :paramtype source_resource_id: str + :keyword upload_size_bytes: If createOption is Upload, this is the size of the contents of the + upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for + the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :paramtype upload_size_bytes: long + :keyword logical_sector_size: Logical sector size in bytes for Ultra disks. Supported values + are 512 ad 4096. 4096 is the default. + :paramtype logical_sector_size: int + :keyword security_data_uri: If createOption is ImportSecure, this is the URI of a blob to be + imported into VM guest state. + :paramtype security_data_uri: str + """ + super(CreationData, self).__init__(**kwargs) + self.create_option = create_option + self.storage_account_id = storage_account_id + self.image_reference = image_reference + self.gallery_image_reference = gallery_image_reference + self.source_uri = source_uri + self.source_resource_id = source_resource_id + self.source_unique_id = None + self.upload_size_bytes = upload_size_bytes + self.logical_sector_size = logical_sector_size + self.security_data_uri = security_data_uri + + +class Resource(msrest.serialization.Model): + """The Resource model definition. + + 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: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, 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}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class Disk(Resource): + """Disk resource. + + 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: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. + :vartype managed_by: str + :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the + disk attached. maxShares should be set to a value greater than one for disks to allow attaching + them to multiple VMs. + :vartype managed_by_extended: list[str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, or StandardSSD_ZRS. + :vartype sku: ~azure.mgmt.compute.v2021_08_01.models.DiskSku + :ivar zones: The Logical zone list for Disk. + :vartype zones: list[str] + :ivar extended_location: The extended location where the disk will be created. Extended + location cannot be changed. + :vartype extended_location: ~azure.mgmt.compute.v2021_08_01.models.ExtendedLocation + :ivar time_created: The time when the disk was created. + :vartype time_created: ~datetime.datetime + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_08_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was + created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + WindowsServer}. + :vartype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :ivar supported_capabilities: List of supported capabilities for the image from which the OS + disk was created. + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :ivar creation_data: Disk source information. CreationData information cannot be changed after + the disk has been created. + :vartype creation_data: ~azure.mgmt.compute.v2021_08_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. + :vartype disk_size_bytes: long + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :ivar encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :vartype disk_m_bps_read_only: long + :ivar disk_state: The state of the disk. Possible values include: "Unattached", "Attached", + "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", "ActiveUpload". + :vartype disk_state: str or ~azure.mgmt.compute.v2021_08_01.models.DiskState + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar share_info: Details of the list of all VMs that have the disk attached. maxShares should + be set to a value greater than one for disks to allow attaching them to multiple VMs. + :vartype share_info: list[~azure.mgmt.compute.v2021_08_01.models.ShareInfoElement] + :ivar network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :vartype bursting_enabled: bool + :ivar property_updates_in_progress: Properties of the disk for which update is pending. + :vartype property_updates_in_progress: + ~azure.mgmt.compute.v2021_08_01.models.PropertyUpdatesInProgress + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar security_profile: Contains the security related information for the resource. + :vartype security_profile: ~azure.mgmt.compute.v2021_08_01.models.DiskSecurityProfile + :ivar completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :vartype completion_percent: float + :ivar public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'managed_by': {'readonly': True}, + 'managed_by_extended': {'readonly': True}, + 'time_created': {'readonly': True}, + 'disk_size_bytes': {'readonly': True}, + 'unique_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'disk_state': {'readonly': True}, + 'share_info': {'readonly': True}, + 'property_updates_in_progress': {'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}'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'managed_by_extended': {'key': 'managedByExtended', 'type': '[str]'}, + 'sku': {'key': 'sku', 'type': 'DiskSku'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, + 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, + 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, + 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, + 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, + 'share_info': {'key': 'properties.shareInfo', 'type': '[ShareInfoElement]'}, + 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, + 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, + 'tier': {'key': 'properties.tier', 'type': 'str'}, + 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, + 'property_updates_in_progress': {'key': 'properties.propertyUpdatesInProgress', 'type': 'PropertyUpdatesInProgress'}, + 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'DiskSecurityProfile'}, + 'completion_percent': {'key': 'properties.completionPercent', 'type': 'float'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["DiskSku"] = None, + zones: Optional[List[str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, + purchase_plan: Optional["PurchasePlan"] = None, + supported_capabilities: Optional["SupportedCapabilities"] = None, + creation_data: Optional["CreationData"] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["EncryptionSettingsCollection"] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + disk_iops_read_only: Optional[int] = None, + disk_m_bps_read_only: Optional[int] = None, + encryption: Optional["Encryption"] = None, + max_shares: Optional[int] = None, + network_access_policy: Optional[Union[str, "NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + tier: Optional[str] = None, + bursting_enabled: Optional[bool] = None, + supports_hibernation: Optional[bool] = None, + security_profile: Optional["DiskSecurityProfile"] = None, + completion_percent: Optional[float] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2021_08_01.models.DiskSku + :keyword zones: The Logical zone list for Disk. + :paramtype zones: list[str] + :keyword extended_location: The extended location where the disk will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2021_08_01.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_08_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + WindowsServer}. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :keyword supported_capabilities: List of supported capabilities for the image from which the OS + disk was created. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2021_08_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used for Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + :keyword security_profile: Contains the security related information for the resource. + :paramtype security_profile: ~azure.mgmt.compute.v2021_08_01.models.DiskSecurityProfile + :keyword completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :paramtype completion_percent: float + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + """ + super(Disk, self).__init__(location=location, tags=tags, **kwargs) + self.managed_by = None + self.managed_by_extended = None + self.sku = sku + self.zones = zones + self.extended_location = extended_location + self.time_created = None + self.os_type = os_type + self.hyper_v_generation = hyper_v_generation + self.purchase_plan = purchase_plan + self.supported_capabilities = supported_capabilities + self.creation_data = creation_data + self.disk_size_gb = disk_size_gb + self.disk_size_bytes = None + self.unique_id = None + self.encryption_settings_collection = encryption_settings_collection + self.provisioning_state = None + self.disk_iops_read_write = disk_iops_read_write + self.disk_m_bps_read_write = disk_m_bps_read_write + self.disk_iops_read_only = disk_iops_read_only + self.disk_m_bps_read_only = disk_m_bps_read_only + self.disk_state = None + self.encryption = encryption + self.max_shares = max_shares + self.share_info = None + self.network_access_policy = network_access_policy + self.disk_access_id = disk_access_id + self.tier = tier + self.bursting_enabled = bursting_enabled + self.property_updates_in_progress = None + self.supports_hibernation = supports_hibernation + self.security_profile = security_profile + self.completion_percent = completion_percent + self.public_network_access = public_network_access + + +class DiskAccess(Resource): + """disk access resource. + + 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: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location where the disk access will be created. Extended + location cannot be changed. + :vartype extended_location: ~azure.mgmt.compute.v2021_08_01.models.ExtendedLocation + :ivar private_endpoint_connections: A readonly collection of private endpoint connections + created on the disk. Currently only one endpoint connection is supported. + :vartype private_endpoint_connections: + list[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection] + :ivar provisioning_state: The disk access resource provisioning state. + :vartype provisioning_state: str + :ivar time_created: The time when the disk access was created. + :vartype time_created: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'private_endpoint_connections': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'time_created': {'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'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location where the disk access will be created. + Extended location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2021_08_01.models.ExtendedLocation + """ + super(DiskAccess, self).__init__(location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.private_endpoint_connections = None + self.provisioning_state = None + self.time_created = None + + +class DiskAccessList(msrest.serialization.Model): + """The List disk access operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of disk access resources. + :vartype value: list[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] + :ivar next_link: The uri to fetch the next page of disk access resources. Call ListNext() with + this to fetch the next page of disk access resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiskAccess]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DiskAccess"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of disk access resources. + :paramtype value: list[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] + :keyword next_link: The uri to fetch the next page of disk access resources. Call ListNext() + with this to fetch the next page of disk access resources. + :paramtype next_link: str + """ + super(DiskAccessList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DiskAccessUpdate(msrest.serialization.Model): + """Used for updating a disk access resource. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(DiskAccessUpdate, self).__init__(**kwargs) + self.tags = tags + + +class DiskEncryptionSet(Resource): + """disk encryption set resource. + + 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: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2021_08_01.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", + "ConfidentialVmEncryptedWithCustomerKey". + :vartype encryption_type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetType + :ivar active_key: The key vault key which is currently used by this disk encryption set. + :vartype active_key: ~azure.mgmt.compute.v2021_08_01.models.KeyForDiskEncryptionSet + :ivar previous_keys: A readonly collection of key vault keys previously used by this disk + encryption set while a key rotation is in progress. It will be empty if there is no ongoing key + rotation. + :vartype previous_keys: list[~azure.mgmt.compute.v2021_08_01.models.KeyForDiskEncryptionSet] + :ivar provisioning_state: The disk encryption set provisioning state. + :vartype provisioning_state: str + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + this disk encryption set to the latest key version. + :vartype rotation_to_latest_key_version_enabled: bool + :ivar last_key_rotation_timestamp: The time when the active key of this disk encryption set was + updated. + :vartype last_key_rotation_timestamp: ~datetime.datetime + :ivar auto_key_rotation_error: The error that was encountered during auto-key rotation. If an + error is present, then auto-key rotation will not be attempted until the error on this disk + encryption set is fixed. + :vartype auto_key_rotation_error: ~azure.mgmt.compute.v2021_08_01.models.ApiError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'previous_keys': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'last_key_rotation_timestamp': {'readonly': True}, + 'auto_key_rotation_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}'}, + 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, + 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, + 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, + 'previous_keys': {'key': 'properties.previousKeys', 'type': '[KeyForDiskEncryptionSet]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'rotation_to_latest_key_version_enabled': {'key': 'properties.rotationToLatestKeyVersionEnabled', 'type': 'bool'}, + 'last_key_rotation_timestamp': {'key': 'properties.lastKeyRotationTimestamp', 'type': 'iso-8601'}, + 'auto_key_rotation_error': {'key': 'properties.autoKeyRotationError', 'type': 'ApiError'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["EncryptionSetIdentity"] = None, + encryption_type: Optional[Union[str, "DiskEncryptionSetType"]] = None, + active_key: Optional["KeyForDiskEncryptionSet"] = None, + rotation_to_latest_key_version_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2021_08_01.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", + "ConfidentialVmEncryptedWithCustomerKey". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetType + :keyword active_key: The key vault key which is currently used by this disk encryption set. + :paramtype active_key: ~azure.mgmt.compute.v2021_08_01.models.KeyForDiskEncryptionSet + :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating + of this disk encryption set to the latest key version. + :paramtype rotation_to_latest_key_version_enabled: bool + """ + super(DiskEncryptionSet, self).__init__(location=location, tags=tags, **kwargs) + self.identity = identity + self.encryption_type = encryption_type + self.active_key = active_key + self.previous_keys = None + self.provisioning_state = None + self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled + self.last_key_rotation_timestamp = None + self.auto_key_rotation_error = None + + +class DiskEncryptionSetList(msrest.serialization.Model): + """The List disk encryption set operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of disk encryption sets. + :vartype value: list[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] + :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with + this to fetch the next page of disk encryption sets. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiskEncryptionSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DiskEncryptionSet"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of disk encryption sets. + :paramtype value: list[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] + :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() + with this to fetch the next page of disk encryption sets. + :paramtype next_link: str + """ + super(DiskEncryptionSetList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DiskEncryptionSetUpdate(msrest.serialization.Model): + """disk encryption set update resource. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The managed identity for the disk encryption set. It should be given permission + on the key vault before it can be used to encrypt disks. + :vartype identity: ~azure.mgmt.compute.v2021_08_01.models.EncryptionSetIdentity + :ivar encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", + "ConfidentialVmEncryptedWithCustomerKey". + :vartype encryption_type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetType + :ivar active_key: Key Vault Key Url to be used for server side encryption of Managed Disks and + Snapshots. + :vartype active_key: ~azure.mgmt.compute.v2021_08_01.models.KeyForDiskEncryptionSet + :ivar rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating of + this disk encryption set to the latest key version. + :vartype rotation_to_latest_key_version_enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'EncryptionSetIdentity'}, + 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, + 'active_key': {'key': 'properties.activeKey', 'type': 'KeyForDiskEncryptionSet'}, + 'rotation_to_latest_key_version_enabled': {'key': 'properties.rotationToLatestKeyVersionEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["EncryptionSetIdentity"] = None, + encryption_type: Optional[Union[str, "DiskEncryptionSetType"]] = None, + active_key: Optional["KeyForDiskEncryptionSet"] = None, + rotation_to_latest_key_version_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The managed identity for the disk encryption set. It should be given + permission on the key vault before it can be used to encrypt disks. + :paramtype identity: ~azure.mgmt.compute.v2021_08_01.models.EncryptionSetIdentity + :keyword encryption_type: The type of key used to encrypt the data of the disk. Possible values + include: "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys", + "ConfidentialVmEncryptedWithCustomerKey". + :paramtype encryption_type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetType + :keyword active_key: Key Vault Key Url to be used for server side encryption of Managed Disks + and Snapshots. + :paramtype active_key: ~azure.mgmt.compute.v2021_08_01.models.KeyForDiskEncryptionSet + :keyword rotation_to_latest_key_version_enabled: Set this flag to true to enable auto-updating + of this disk encryption set to the latest key version. + :paramtype rotation_to_latest_key_version_enabled: bool + """ + super(DiskEncryptionSetUpdate, self).__init__(**kwargs) + self.tags = tags + self.identity = identity + self.encryption_type = encryption_type + self.active_key = active_key + self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled + + +class DiskList(msrest.serialization.Model): + """The List Disks operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of disks. + :vartype value: list[~azure.mgmt.compute.v2021_08_01.models.Disk] + :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Disk]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Disk"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of disks. + :paramtype value: list[~azure.mgmt.compute.v2021_08_01.models.Disk] + :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch + the next page of disks. + :paramtype next_link: str + """ + super(DiskList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProxyOnlyResource(msrest.serialization.Model): + """The ProxyOnly Resource model definition. + + 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 + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DiskRestorePoint(ProxyOnlyResource): + """Properties of disk restore point. + + 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 time_created: The timestamp of restorePoint creation. + :vartype time_created: ~datetime.datetime + :ivar source_resource_id: arm id of source disk or source disk restore point. + :vartype source_resource_id: str + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_08_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was + created. + :vartype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :ivar supported_capabilities: List of supported capabilities (like accelerated networking) for + the image from which the OS disk was created. + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :ivar family_id: id of the backing snapshot's MIS family. + :vartype family_id: str + :ivar source_unique_id: unique incarnation id of the source disk. + :vartype source_unique_id: str + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :ivar public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar completion_percent: Percentage complete for the background copy of disk restore point + when source resource is from a different region. + :vartype completion_percent: float + :ivar replication_state: Replication state of disk restore point when source resource is from a + different region. + :vartype replication_state: str + :ivar source_resource_location: Location of source disk or source disk restore point when + source resource is from a different region. + :vartype source_resource_location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'time_created': {'readonly': True}, + 'source_resource_id': {'readonly': True}, + 'os_type': {'readonly': True}, + 'family_id': {'readonly': True}, + 'source_unique_id': {'readonly': True}, + 'encryption': {'readonly': True}, + 'replication_state': {'readonly': True}, + 'source_resource_location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, + 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, + 'family_id': {'key': 'properties.familyId', 'type': 'str'}, + 'source_unique_id': {'key': 'properties.sourceUniqueId', 'type': 'str'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, + 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, + 'completion_percent': {'key': 'properties.completionPercent', 'type': 'float'}, + 'replication_state': {'key': 'properties.replicationState', 'type': 'str'}, + 'source_resource_location': {'key': 'properties.sourceResourceLocation', 'type': 'str'}, + } + + def __init__( + self, + *, + hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, + purchase_plan: Optional["PurchasePlan"] = None, + supported_capabilities: Optional["SupportedCapabilities"] = None, + supports_hibernation: Optional[bool] = None, + network_access_policy: Optional[Union[str, "NetworkAccessPolicy"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + disk_access_id: Optional[str] = None, + completion_percent: Optional[float] = None, + **kwargs + ): + """ + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_08_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was + created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :keyword supported_capabilities: List of supported capabilities (like accelerated networking) + for the image from which the OS disk was created. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword completion_percent: Percentage complete for the background copy of disk restore point + when source resource is from a different region. + :paramtype completion_percent: float + """ + super(DiskRestorePoint, self).__init__(**kwargs) + self.time_created = None + self.source_resource_id = None + self.os_type = None + self.hyper_v_generation = hyper_v_generation + self.purchase_plan = purchase_plan + self.supported_capabilities = supported_capabilities + self.family_id = None + self.source_unique_id = None + self.encryption = None + self.supports_hibernation = supports_hibernation + self.network_access_policy = network_access_policy + self.public_network_access = public_network_access + self.disk_access_id = disk_access_id + self.completion_percent = completion_percent + self.replication_state = None + self.source_resource_location = None + + +class DiskRestorePointList(msrest.serialization.Model): + """The List Disk Restore Points operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of disk restore points. + :vartype value: list[~azure.mgmt.compute.v2021_08_01.models.DiskRestorePoint] + :ivar next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + this to fetch the next page of disk restore points. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiskRestorePoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DiskRestorePoint"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of disk restore points. + :paramtype value: list[~azure.mgmt.compute.v2021_08_01.models.DiskRestorePoint] + :keyword next_link: The uri to fetch the next page of disk restore points. Call ListNext() with + this to fetch the next page of disk restore points. + :paramtype next_link: str + """ + super(DiskRestorePointList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DiskSecurityProfile(msrest.serialization.Model): + """Contains the security related information for the resource. + + :ivar security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. + Possible values include: "TrustedLaunch", + "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + "ConfidentialVM_DiskEncryptedWithPlatformKey", "ConfidentialVM_DiskEncryptedWithCustomerKey". + :vartype security_type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskSecurityTypes + :ivar secure_vm_disk_encryption_set_id: ResourceId of the disk encryption set associated to + Confidential VM supported disk encrypted with customer managed key. + :vartype secure_vm_disk_encryption_set_id: str + """ + + _attribute_map = { + 'security_type': {'key': 'securityType', 'type': 'str'}, + 'secure_vm_disk_encryption_set_id': {'key': 'secureVMDiskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + *, + security_type: Optional[Union[str, "DiskSecurityTypes"]] = None, + secure_vm_disk_encryption_set_id: Optional[str] = None, + **kwargs + ): + """ + :keyword security_type: Specifies the SecurityType of the VM. Applicable for OS disks only. + Possible values include: "TrustedLaunch", + "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + "ConfidentialVM_DiskEncryptedWithPlatformKey", "ConfidentialVM_DiskEncryptedWithCustomerKey". + :paramtype security_type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskSecurityTypes + :keyword secure_vm_disk_encryption_set_id: ResourceId of the disk encryption set associated to + Confidential VM supported disk encrypted with customer managed key. + :paramtype secure_vm_disk_encryption_set_id: str + """ + super(DiskSecurityProfile, self).__init__(**kwargs) + self.security_type = security_type + self.secure_vm_disk_encryption_set_id = secure_vm_disk_encryption_set_id + + +class DiskSku(msrest.serialization.Model): + """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". + :vartype name: str or ~azure.mgmt.compute.v2021_08_01.models.DiskStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "DiskStorageAccountTypes"]] = None, + **kwargs + ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2021_08_01.models.DiskStorageAccountTypes + """ + super(DiskSku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class DiskUpdate(msrest.serialization.Model): + """Disk update resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + Premium_ZRS, or StandardSSD_ZRS. + :vartype sku: ~azure.mgmt.compute.v2021_08_01.models.DiskSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :ivar disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :vartype disk_m_bps_read_write: long + :ivar disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :vartype disk_iops_read_only: long + :ivar disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :vartype disk_m_bps_read_only: long + :ivar max_shares: The maximum number of VMs that can attach to the disk at the same time. Value + greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :vartype max_shares: int + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :vartype tier: str + :ivar bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :vartype bursting_enabled: bool + :ivar purchase_plan: Purchase plan information to be added on the OS disk. + :vartype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :ivar supported_capabilities: List of supported capabilities (like accelerated networking) to + be added on the OS disk. + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :ivar property_updates_in_progress: Properties of the disk for which update is pending. + :vartype property_updates_in_progress: + ~azure.mgmt.compute.v2021_08_01.models.PropertyUpdatesInProgress + :ivar supports_hibernation: Indicates the OS on a disk supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + """ + + _validation = { + 'property_updates_in_progress': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'DiskSku'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'long'}, + 'disk_iops_read_only': {'key': 'properties.diskIOPSReadOnly', 'type': 'long'}, + 'disk_m_bps_read_only': {'key': 'properties.diskMBpsReadOnly', 'type': 'long'}, + 'max_shares': {'key': 'properties.maxShares', 'type': 'int'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, + 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, + 'tier': {'key': 'properties.tier', 'type': 'str'}, + 'bursting_enabled': {'key': 'properties.burstingEnabled', 'type': 'bool'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, + 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, + 'property_updates_in_progress': {'key': 'properties.propertyUpdatesInProgress', 'type': 'PropertyUpdatesInProgress'}, + 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["DiskSku"] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["EncryptionSettingsCollection"] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + disk_iops_read_only: Optional[int] = None, + disk_m_bps_read_only: Optional[int] = None, + max_shares: Optional[int] = None, + encryption: Optional["Encryption"] = None, + network_access_policy: Optional[Union[str, "NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + tier: Optional[str] = None, + bursting_enabled: Optional[bool] = None, + purchase_plan: Optional["PurchasePlan"] = None, + supported_capabilities: Optional["SupportedCapabilities"] = None, + supports_hibernation: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + :paramtype sku: ~azure.mgmt.compute.v2021_08_01.models.DiskSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :keyword disk_iops_read_write: The number of IOPS allowed for this disk; only settable for + UltraSSD disks. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The bandwidth allowed for this disk; only settable for UltraSSD + disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + 10. + :paramtype disk_m_bps_read_write: long + :keyword disk_iops_read_only: The total number of IOPS that will be allowed across all VMs + mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + :paramtype disk_iops_read_only: long + :keyword disk_m_bps_read_only: The total throughput (MBps) that will be allowed across all VMs + mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses + the ISO notation, of powers of 10. + :paramtype disk_m_bps_read_only: long + :keyword max_shares: The maximum number of VMs that can attach to the disk at the same time. + Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + :paramtype max_shares: int + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword tier: Performance tier of the disk (e.g, P4, S10) as described here: + https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra + disks. + :paramtype tier: str + :keyword bursting_enabled: Set to true to enable bursting beyond the provisioned performance + target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + :paramtype bursting_enabled: bool + :keyword purchase_plan: Purchase plan information to be added on the OS disk. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :keyword supported_capabilities: List of supported capabilities (like accelerated networking) + to be added on the OS disk. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. + :paramtype supports_hibernation: bool + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + """ + super(DiskUpdate, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + self.os_type = os_type + self.disk_size_gb = disk_size_gb + self.encryption_settings_collection = encryption_settings_collection + self.disk_iops_read_write = disk_iops_read_write + self.disk_m_bps_read_write = disk_m_bps_read_write + self.disk_iops_read_only = disk_iops_read_only + self.disk_m_bps_read_only = disk_m_bps_read_only + self.max_shares = max_shares + self.encryption = encryption + self.network_access_policy = network_access_policy + self.disk_access_id = disk_access_id + self.tier = tier + self.bursting_enabled = bursting_enabled + self.purchase_plan = purchase_plan + self.supported_capabilities = supported_capabilities + self.property_updates_in_progress = None + self.supports_hibernation = supports_hibernation + self.public_network_access = public_network_access + + +class Encryption(msrest.serialization.Model): + """Encryption at rest settings for disk or snapshot. + + :ivar disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :vartype disk_encryption_set_id: str + :ivar type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :vartype type: str or ~azure.mgmt.compute.v2021_08_01.models.EncryptionType + """ + + _attribute_map = { + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + disk_encryption_set_id: Optional[str] = None, + type: Optional[Union[str, "EncryptionType"]] = None, + **kwargs + ): + """ + :keyword disk_encryption_set_id: ResourceId of the disk encryption set to use for enabling + encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type: The type of key used to encrypt the data of the disk. Possible values include: + "EncryptionAtRestWithPlatformKey", "EncryptionAtRestWithCustomerKey", + "EncryptionAtRestWithPlatformAndCustomerKeys". + :paramtype type: str or ~azure.mgmt.compute.v2021_08_01.models.EncryptionType + """ + super(Encryption, self).__init__(**kwargs) + self.disk_encryption_set_id = disk_encryption_set_id + self.type = type + + +class EncryptionSetIdentity(msrest.serialization.Model): + """The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + supported for new creations. Disk Encryption Sets can be updated with Identity type None during + migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted + resources to lose access to the keys. Possible values include: "SystemAssigned", "None". + :vartype type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetIdentityType + :ivar principal_id: The object id of the Managed Identity Resource. This will be sent to the RP + from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a + systemAssigned(implicit) identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the Managed Identity Resource. This will be sent to the RP + from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a + systemAssigned(implicit) identity. + :vartype tenant_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "DiskEncryptionSetIdentityType"]] = None, + **kwargs + ): + """ + :keyword type: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned + is supported for new creations. Disk Encryption Sets can be updated with Identity type None + during migration of subscription to a new Azure Active Directory tenant; it will cause the + encrypted resources to lose access to the keys. Possible values include: "SystemAssigned", + "None". + :paramtype type: str or ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetIdentityType + """ + super(EncryptionSetIdentity, self).__init__(**kwargs) + self.type = type + self.principal_id = None + self.tenant_id = None + + +class EncryptionSettingsCollection(msrest.serialization.Model): + """Encryption settings for disk or snapshot. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :vartype enabled: bool + :ivar encryption_settings: A collection of encryption settings, one for each disk volume. + :vartype encryption_settings: + list[~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsElement] + :ivar encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :vartype encryption_settings_version: str + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, + 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: bool, + encryption_settings: Optional[List["EncryptionSettingsElement"]] = None, + encryption_settings_version: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Required. Set this flag to true and provide DiskEncryptionKey and optional + KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and + KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :paramtype enabled: bool + :keyword encryption_settings: A collection of encryption settings, one for each disk volume. + :paramtype encryption_settings: + list[~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsElement] + :keyword encryption_settings_version: Describes what type of encryption is used for the disks. + Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption + with AAD app.'1.1' corresponds to Azure Disk Encryption. + :paramtype encryption_settings_version: str + """ + super(EncryptionSettingsCollection, self).__init__(**kwargs) + self.enabled = enabled + self.encryption_settings = encryption_settings + self.encryption_settings_version = encryption_settings_version + + +class EncryptionSettingsElement(msrest.serialization.Model): + """Encryption settings for one disk volume. + + :ivar disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2021_08_01.models.KeyVaultAndSecretReference + :ivar key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :vartype key_encryption_key: ~azure.mgmt.compute.v2021_08_01.models.KeyVaultAndKeyReference + """ + + _attribute_map = { + 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, + 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, + } + + def __init__( + self, + *, + disk_encryption_key: Optional["KeyVaultAndSecretReference"] = None, + key_encryption_key: Optional["KeyVaultAndKeyReference"] = None, + **kwargs + ): + """ + :keyword disk_encryption_key: Key Vault Secret Url and vault id of the disk encryption key. + :paramtype disk_encryption_key: + ~azure.mgmt.compute.v2021_08_01.models.KeyVaultAndSecretReference + :keyword key_encryption_key: Key Vault Key Url and vault id of the key encryption key. + KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2021_08_01.models.KeyVaultAndKeyReference + """ + super(EncryptionSettingsElement, self).__init__(**kwargs) + self.disk_encryption_key = disk_encryption_key + self.key_encryption_key = key_encryption_key + + +class ExtendedLocation(msrest.serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.compute.v2021_08_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 + ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.compute.v2021_08_01.models.ExtendedLocationTypes + """ + super(ExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + +class GrantAccessData(msrest.serialization.Model): + """Data used for requesting a SAS. + + All required parameters must be populated in order to send to Azure. + + :ivar access: Required. Possible values include: "None", "Read", "Write". + :vartype access: str or ~azure.mgmt.compute.v2021_08_01.models.AccessLevel + :ivar duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :vartype duration_in_seconds: int + :ivar get_secure_vm_guest_state_sas: Set this flag to true to get additional SAS for VM guest + state. + :vartype get_secure_vm_guest_state_sas: bool + """ + + _validation = { + 'access': {'required': True}, + 'duration_in_seconds': {'required': True}, + } + + _attribute_map = { + 'access': {'key': 'access', 'type': 'str'}, + 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, + 'get_secure_vm_guest_state_sas': {'key': 'getSecureVMGuestStateSAS', 'type': 'bool'}, + } + + def __init__( + self, + *, + access: Union[str, "AccessLevel"], + duration_in_seconds: int, + get_secure_vm_guest_state_sas: Optional[bool] = None, + **kwargs + ): + """ + :keyword access: Required. Possible values include: "None", "Read", "Write". + :paramtype access: str or ~azure.mgmt.compute.v2021_08_01.models.AccessLevel + :keyword duration_in_seconds: Required. Time duration in seconds until the SAS access expires. + :paramtype duration_in_seconds: int + :keyword get_secure_vm_guest_state_sas: Set this flag to true to get additional SAS for VM + guest state. + :paramtype get_secure_vm_guest_state_sas: bool + """ + super(GrantAccessData, self).__init__(**kwargs) + self.access = access + self.duration_in_seconds = duration_in_seconds + self.get_secure_vm_guest_state_sas = get_secure_vm_guest_state_sas + + +class ImageDiskReference(msrest.serialization.Model): + """The source image used for creating the disk. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. A relative uri containing either a Platform Image Repository or user image + reference. + :vartype id: str + :ivar lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :vartype lun: int + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + *, + id: str, + lun: Optional[int] = None, + **kwargs + ): + """ + :keyword id: Required. A relative uri containing either a Platform Image Repository or user + image reference. + :paramtype id: str + :keyword lun: If the disk is created from an image's data disk, this is an index that indicates + which of the data disks in the image to use. For OS disks, this field is null. + :paramtype lun: int + """ + super(ImageDiskReference, self).__init__(**kwargs) + self.id = id + self.lun = lun + + +class InnerError(msrest.serialization.Model): + """Inner error details. + + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype 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 + ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ + super(InnerError, self).__init__(**kwargs) + self.exceptiontype = exceptiontype + self.errordetail = errordetail + + +class KeyForDiskEncryptionSet(msrest.serialization.Model): + """Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. + + All required parameters must be populated in order to send to Azure. + + :ivar source_vault: Resource id of the KeyVault containing the key or secret. This property is + optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption + Set subscription. + :vartype source_vault: ~azure.mgmt.compute.v2021_08_01.models.SourceVault + :ivar key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version segment + of the Url is required regardless of rotationToLatestKeyVersionEnabled value. + :vartype key_url: str + """ + + _validation = { + 'key_url': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, + 'key_url': {'key': 'keyUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + key_url: str, + source_vault: Optional["SourceVault"] = None, + **kwargs + ): + """ + :keyword source_vault: Resource id of the KeyVault containing the key or secret. This property + is optional and cannot be used if the KeyVault subscription is not the same as the Disk + Encryption Set subscription. + :paramtype source_vault: ~azure.mgmt.compute.v2021_08_01.models.SourceVault + :keyword key_url: Required. Fully versioned Key Url pointing to a key in KeyVault. Version + segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. + :paramtype key_url: str + """ + super(KeyForDiskEncryptionSet, self).__init__(**kwargs) + self.source_vault = source_vault + self.key_url = key_url + + +class KeyVaultAndKeyReference(msrest.serialization.Model): + """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. + + All required parameters must be populated in order to send to Azure. + + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2021_08_01.models.SourceVault + :ivar key_url: Required. Url pointing to a key or secret in KeyVault. + :vartype key_url: str + """ + + _validation = { + 'source_vault': {'required': True}, + 'key_url': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, + 'key_url': {'key': 'keyUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + source_vault: "SourceVault", + key_url: str, + **kwargs + ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2021_08_01.models.SourceVault + :keyword key_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype key_url: str + """ + super(KeyVaultAndKeyReference, self).__init__(**kwargs) + self.source_vault = source_vault + self.key_url = key_url + + +class KeyVaultAndSecretReference(msrest.serialization.Model): + """Key Vault Secret Url and vault id of the encryption key. + + All required parameters must be populated in order to send to Azure. + + :ivar source_vault: Required. Resource id of the KeyVault containing the key or secret. + :vartype source_vault: ~azure.mgmt.compute.v2021_08_01.models.SourceVault + :ivar secret_url: Required. Url pointing to a key or secret in KeyVault. + :vartype secret_url: str + """ + + _validation = { + 'source_vault': {'required': True}, + 'secret_url': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + source_vault: "SourceVault", + secret_url: str, + **kwargs + ): + """ + :keyword source_vault: Required. Resource id of the KeyVault containing the key or secret. + :paramtype source_vault: ~azure.mgmt.compute.v2021_08_01.models.SourceVault + :keyword secret_url: Required. Url pointing to a key or secret in KeyVault. + :paramtype secret_url: str + """ + super(KeyVaultAndSecretReference, self).__init__(**kwargs) + self.source_vault = source_vault + self.secret_url = secret_url + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: private endpoint connection Id. + :vartype id: str + :ivar name: private endpoint connection name. + :vartype name: str + :ivar type: private endpoint connection type. + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between DiskAccess and Virtual Network. + :vartype private_link_service_connection_state: + ~azure.mgmt.compute.v2021_08_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'private_endpoint': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between DiskAccess and Virtual Network. + :paramtype private_link_service_connection_state: + ~azure.mgmt.compute.v2021_08_01.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.private_endpoint = None + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """A list of private link resources. + + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(msrest.serialization.Model): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: private link resource Id. + :vartype id: str + :ivar name: private link resource name. + :vartype name: str + :ivar type: private link resource type. + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource DNS zone name. + :vartype required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword required_zone_names: The private link resource DNS zone name. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.compute.v2021_08_01.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.compute.v2021_08_01.models.PrivateLinkResource] + """ + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :vartype status: str or + ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class PropertyUpdatesInProgress(msrest.serialization.Model): + """Properties of the disk for which update is pending. + + :ivar target_tier: The target performance tier of the disk if a tier change operation is in + progress. + :vartype target_tier: str + """ + + _attribute_map = { + 'target_tier': {'key': 'targetTier', 'type': 'str'}, + } + + def __init__( + self, + *, + target_tier: Optional[str] = None, + **kwargs + ): + """ + :keyword target_tier: The target performance tier of the disk if a tier change operation is in + progress. + :paramtype target_tier: str + """ + super(PropertyUpdatesInProgress, self).__init__(**kwargs) + self.target_tier = target_tier + + +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. + + :ivar name: Required. The plan ID. + :vartype name: str + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar product: Required. Specifies the product of the image from the marketplace. This is the + same value as Offer under the imageReference element. + :vartype product: str + :ivar promotion_code: The Offer Promotion Code. + :vartype promotion_code: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + } + + _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: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The plan ID. + :paramtype name: str + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword product: Required. Specifies the product of the image from the marketplace. This is + the same value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The Offer Promotion Code. + :paramtype promotion_code: str + """ + super(PurchasePlan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + + +class ResourceUriList(msrest.serialization.Model): + """The List resources which are encrypted with the disk encryption set. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + disk encryption set. + :vartype value: list[str] + :ivar next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + this to fetch the next page of encrypted resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List[str], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of IDs or Owner IDs of resources which are encrypted with the + disk encryption set. + :paramtype value: list[str] + :keyword next_link: The uri to fetch the next page of encrypted resources. Call ListNext() with + this to fetch the next page of encrypted resources. + :paramtype next_link: str + """ + super(ResourceUriList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ShareInfoElement(msrest.serialization.Model): + """ShareInfoElement. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vm_uri: A relative URI containing the ID of the VM that has the disk attached. + :vartype vm_uri: str + """ + + _validation = { + 'vm_uri': {'readonly': True}, + } + + _attribute_map = { + 'vm_uri': {'key': 'vmUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ShareInfoElement, self).__init__(**kwargs) + self.vm_uri = None + + +class Snapshot(Resource): + """Snapshot resource. + + 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: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar managed_by: Unused. Always Null. + :vartype managed_by: str + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + an optional parameter for incremental snapshot and the default behavior is the SKU will be set + to the same sku as the previous snapshot. + :vartype sku: ~azure.mgmt.compute.v2021_08_01.models.SnapshotSku + :ivar extended_location: The extended location where the snapshot will be created. Extended + location cannot be changed. + :vartype extended_location: ~azure.mgmt.compute.v2021_08_01.models.ExtendedLocation + :ivar time_created: The time when the snapshot was created. + :vartype time_created: ~datetime.datetime + :ivar os_type: The Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2021_08_01.models.HyperVGeneration + :ivar purchase_plan: Purchase plan information for the image from which the source disk for the + snapshot was originally created. + :vartype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :ivar supported_capabilities: List of supported capabilities (like Accelerated Networking) for + the image from which the source disk from the snapshot was originally created. + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :ivar creation_data: Disk source information. CreationData information cannot be changed after + the disk has been created. + :vartype creation_data: ~azure.mgmt.compute.v2021_08_01.models.CreationData + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read only. + :vartype disk_size_bytes: long + :ivar disk_state: The state of the snapshot. Possible values include: "Unattached", "Attached", + "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", "ActiveUpload". + :vartype disk_state: str or ~azure.mgmt.compute.v2021_08_01.models.DiskState + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :ivar incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :vartype incremental: bool + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar security_profile: Contains the security related information for the resource. + :vartype security_profile: ~azure.mgmt.compute.v2021_08_01.models.DiskSecurityProfile + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + :ivar completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :vartype completion_percent: float + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'managed_by': {'readonly': True}, + 'time_created': {'readonly': True}, + 'disk_size_bytes': {'readonly': True}, + 'disk_state': {'readonly': True}, + 'unique_id': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'PurchasePlan'}, + 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, + 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, + 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'DiskSecurityProfile'}, + 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'completion_percent': {'key': 'properties.completionPercent', 'type': 'float'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SnapshotSku"] = None, + extended_location: Optional["ExtendedLocation"] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, + purchase_plan: Optional["PurchasePlan"] = None, + supported_capabilities: Optional["SupportedCapabilities"] = None, + creation_data: Optional["CreationData"] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["EncryptionSettingsCollection"] = None, + incremental: Optional[bool] = None, + encryption: Optional["Encryption"] = None, + network_access_policy: Optional[Union[str, "NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + security_profile: Optional["DiskSecurityProfile"] = None, + supports_hibernation: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + completion_percent: Optional[float] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2021_08_01.models.SnapshotSku + :keyword extended_location: The extended location where the snapshot will be created. Extended + location cannot be changed. + :paramtype extended_location: ~azure.mgmt.compute.v2021_08_01.models.ExtendedLocation + :keyword os_type: The Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2021_08_01.models.HyperVGeneration + :keyword purchase_plan: Purchase plan information for the image from which the source disk for + the snapshot was originally created. + :paramtype purchase_plan: ~azure.mgmt.compute.v2021_08_01.models.PurchasePlan + :keyword supported_capabilities: List of supported capabilities (like Accelerated Networking) + for the image from which the source disk from the snapshot was originally created. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + :keyword creation_data: Disk source information. CreationData information cannot be changed + after the disk has been created. + :paramtype creation_data: ~azure.mgmt.compute.v2021_08_01.models.CreationData + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :keyword incremental: Whether a snapshot is incremental. Incremental snapshots on the same disk + occupy less space than full snapshots and can be diffed. + :paramtype incremental: bool + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword security_profile: Contains the security related information for the resource. + :paramtype security_profile: ~azure.mgmt.compute.v2021_08_01.models.DiskSecurityProfile + :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :paramtype supports_hibernation: bool + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + :keyword completion_percent: Percentage complete for the background copy when a resource is + created via the CopyStart operation. + :paramtype completion_percent: float + """ + super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + self.managed_by = None + self.sku = sku + self.extended_location = extended_location + self.time_created = None + self.os_type = os_type + self.hyper_v_generation = hyper_v_generation + self.purchase_plan = purchase_plan + self.supported_capabilities = supported_capabilities + self.creation_data = creation_data + self.disk_size_gb = disk_size_gb + self.disk_size_bytes = None + self.disk_state = None + self.unique_id = None + self.encryption_settings_collection = encryption_settings_collection + self.provisioning_state = None + self.incremental = incremental + self.encryption = encryption + self.network_access_policy = network_access_policy + self.disk_access_id = disk_access_id + self.security_profile = security_profile + self.supports_hibernation = supports_hibernation + self.public_network_access = public_network_access + self.completion_percent = completion_percent + + +class SnapshotList(msrest.serialization.Model): + """The List Snapshots operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of snapshots. + :vartype value: list[~azure.mgmt.compute.v2021_08_01.models.Snapshot] + :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Snapshot"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of snapshots. + :paramtype value: list[~azure.mgmt.compute.v2021_08_01.models.Snapshot] + :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to + fetch the next page of snapshots. + :paramtype next_link: str + """ + super(SnapshotList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SnapshotSku(msrest.serialization.Model): + """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :vartype name: str or ~azure.mgmt.compute.v2021_08_01.models.SnapshotStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "SnapshotStorageAccountTypes"]] = None, + **kwargs + ): + """ + :keyword name: The sku name. Possible values include: "Standard_LRS", "Premium_LRS", + "Standard_ZRS". + :paramtype name: str or ~azure.mgmt.compute.v2021_08_01.models.SnapshotStorageAccountTypes + """ + super(SnapshotSku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class SnapshotUpdate(msrest.serialization.Model): + """Snapshot update resource. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is + an optional parameter for incremental snapshot and the default behavior is the SKU will be set + to the same sku as the previous snapshot. + :vartype sku: ~azure.mgmt.compute.v2021_08_01.models.SnapshotSku + :ivar os_type: the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :ivar disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :vartype disk_size_gb: int + :ivar encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :vartype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :ivar encryption: Encryption property can be used to encrypt data at rest with customer managed + keys or platform managed keys. + :vartype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :ivar network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :vartype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :ivar disk_access_id: ARM id of the DiskAccess resource for using private endpoints on disks. + :vartype disk_access_id: str + :ivar supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :vartype supports_hibernation: bool + :ivar public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + :ivar supported_capabilities: List of supported capabilities (like accelerated networking) for + the image from which the OS disk was created. + :vartype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'network_access_policy': {'key': 'properties.networkAccessPolicy', 'type': 'str'}, + 'disk_access_id': {'key': 'properties.diskAccessId', 'type': 'str'}, + 'supports_hibernation': {'key': 'properties.supportsHibernation', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'supported_capabilities': {'key': 'properties.supportedCapabilities', 'type': 'SupportedCapabilities'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SnapshotSku"] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + disk_size_gb: Optional[int] = None, + encryption_settings_collection: Optional["EncryptionSettingsCollection"] = None, + encryption: Optional["Encryption"] = None, + network_access_policy: Optional[Union[str, "NetworkAccessPolicy"]] = None, + disk_access_id: Optional[str] = None, + supports_hibernation: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + supported_capabilities: Optional["SupportedCapabilities"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This + is an optional parameter for incremental snapshot and the default behavior is the SKU will be + set to the same sku as the previous snapshot. + :paramtype sku: ~azure.mgmt.compute.v2021_08_01.models.SnapshotSku + :keyword os_type: the Operating System type. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2021_08_01.models.OperatingSystemTypes + :keyword disk_size_gb: If creationData.createOption is Empty, this field is mandatory and it + indicates the size of the disk to create. If this field is present for updates or creation with + other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a + running VM, and can only increase the disk's size. + :paramtype disk_size_gb: int + :keyword encryption_settings_collection: Encryption settings collection used be Azure Disk + Encryption, can contain multiple encryption settings per disk or snapshot. + :paramtype encryption_settings_collection: + ~azure.mgmt.compute.v2021_08_01.models.EncryptionSettingsCollection + :keyword encryption: Encryption property can be used to encrypt data at rest with customer + managed keys or platform managed keys. + :paramtype encryption: ~azure.mgmt.compute.v2021_08_01.models.Encryption + :keyword network_access_policy: Policy for accessing the disk via network. Possible values + include: "AllowAll", "AllowPrivate", "DenyAll". + :paramtype network_access_policy: str or + ~azure.mgmt.compute.v2021_08_01.models.NetworkAccessPolicy + :keyword disk_access_id: ARM id of the DiskAccess resource for using private endpoints on + disks. + :paramtype disk_access_id: str + :keyword supports_hibernation: Indicates the OS on a snapshot supports hibernation. + :paramtype supports_hibernation: bool + :keyword public_network_access: Policy for controlling export on the disk. Possible values + include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.compute.v2021_08_01.models.PublicNetworkAccess + :keyword supported_capabilities: List of supported capabilities (like accelerated networking) + for the image from which the OS disk was created. + :paramtype supported_capabilities: ~azure.mgmt.compute.v2021_08_01.models.SupportedCapabilities + """ + super(SnapshotUpdate, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + self.os_type = os_type + self.disk_size_gb = disk_size_gb + self.encryption_settings_collection = encryption_settings_collection + self.encryption = encryption + self.network_access_policy = network_access_policy + self.disk_access_id = disk_access_id + self.supports_hibernation = supports_hibernation + self.public_network_access = public_network_access + self.supported_capabilities = supported_capabilities + + +class SourceVault(msrest.serialization.Model): + """The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. + + :ivar id: Resource Id. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ + super(SourceVault, self).__init__(**kwargs) + self.id = id + + +class SupportedCapabilities(msrest.serialization.Model): + """List of supported capabilities (like accelerated networking) persisted on the disk resource for VM use. + + :ivar accelerated_network: True if the image from which the OS disk is created supports + accelerated networking. + :vartype accelerated_network: bool + """ + + _attribute_map = { + 'accelerated_network': {'key': 'acceleratedNetwork', 'type': 'bool'}, + } + + def __init__( + self, + *, + accelerated_network: Optional[bool] = None, + **kwargs + ): + """ + :keyword accelerated_network: True if the image from which the OS disk is created supports + accelerated networking. + :paramtype accelerated_network: bool + """ + super(SupportedCapabilities, self).__init__(**kwargs) + self.accelerated_network = accelerated_network diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/__init__.py new file mode 100644 index 000000000000..c3e7f3bd4f2e --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._disks_operations import DisksOperations +from ._snapshots_operations import SnapshotsOperations +from ._disk_encryption_sets_operations import DiskEncryptionSetsOperations +from ._disk_accesses_operations import DiskAccessesOperations +from ._disk_restore_point_operations import DiskRestorePointOperations + +__all__ = [ + 'DisksOperations', + 'SnapshotsOperations', + 'DiskEncryptionSetsOperations', + 'DiskAccessesOperations', + 'DiskRestorePointOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_accesses_operations.py new file mode 100644 index 000000000000..fcf41e8c5e5c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_accesses_operations.py @@ -0,0 +1,1410 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_a_private_endpoint_connection_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_a_private_endpoint_connection_request_initial( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_endpoint_connections_request( + subscription_id: str, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class DiskAccessesOperations(object): + """DiskAccessesOperations 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_08_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: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> "_models.DiskAccess": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccess') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskAccess', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccess", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: + """Creates or updates a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + :type disk_access: ~azure.mgmt.compute.v2021_08_01.models.DiskAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + 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, + disk_access_name=disk_access_name, + disk_access=disk_access, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskAccess', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/diskAccesses/{diskAccessName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> "_models.DiskAccess": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_access, 'DiskAccessUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskAccess', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_access_name: str, + disk_access: "_models.DiskAccessUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskAccess"]: + """Updates (patches) a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :type disk_access: ~azure.mgmt.compute.v2021_08_01.models.DiskAccessUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + 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, + disk_access_name=disk_access_name, + disk_access=disk_access, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskAccess', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.DiskAccess": + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskAccess, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.DiskAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/diskAccesses/{diskAccessName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + disk_access_name=disk_access_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/diskAccesses/{diskAccessName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: + """Lists all the disk access resources 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 DiskAccessList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", 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/diskAccesses'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.DiskAccessList"]: + """Lists all the disk access resources under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskAccessList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", 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/diskAccesses'} # type: ignore + + @distributed_trace + def get_private_link_resources( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": + """Gets the private link resources possible under disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.get_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + + + def _update_a_private_endpoint_connection_initial( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_update_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def begin_update_a_private_endpoint_connection( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. + :type private_endpoint_connection: + ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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_a_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace + def get_a_private_endpoint_connection( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets information about a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_a_private_endpoint_connection_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get_a_private_endpoint_connection.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + def _delete_a_private_endpoint_connection_initial( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_a_private_endpoint_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def begin_delete_a_private_endpoint_connection( + self, + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection under a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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_a_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace + def list_private_endpoint_connections( + self, + resource_group_name: str, + disk_access_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + """List information about private endpoint connections under a disk access resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_access_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=self.list_private_endpoint_connections.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_private_endpoint_connections_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", 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_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_encryption_sets_operations.py new file mode 100644 index 000000000000..370a0fcaaf96 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_encryption_sets_operations.py @@ -0,0 +1,915 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_associated_resources_request( + subscription_id: str, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class DiskEncryptionSetsOperations(object): + """DiskEncryptionSetsOperations 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_08_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: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskEncryptionSet', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSet", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: + """Creates or updates a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + 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, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> "_models.DiskEncryptionSet": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskEncryptionSet', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: "_models.DiskEncryptionSetUpdate", + **kwargs: Any + ) -> LROPoller["_models.DiskEncryptionSet"]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + 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, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DiskEncryptionSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> "_models.DiskEncryptionSet": + """Gets information about a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskEncryptionSet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskEncryptionSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + disk_encryption_set_name=disk_encryption_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: + """Lists all the disk encryption 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 DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", 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/diskEncryptionSets'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.DiskEncryptionSetList"]: + """Lists all the disk encryption sets under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskEncryptionSetList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", 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/diskEncryptionSets'} # type: ignore + + @distributed_trace + def list_associated_resources( + self, + resource_group_name: str, + disk_encryption_set_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceUriList"]: + """Lists all resources that are encrypted with this disk encryption set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + :type disk_encryption_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 ResourceUriList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.ResourceUriList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=self.list_associated_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_associated_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceUriList", 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_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_restore_point_operations.py new file mode 100644 index 000000000000..a11c1288a624 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_restore_point_operations.py @@ -0,0 +1,599 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_restore_point_request( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "restorePointCollectionName": _SERIALIZER.url("restore_point_collection_name", restore_point_collection_name, 'str'), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class DiskRestorePointOperations(object): + """DiskRestorePointOperations 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_08_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 + + @distributed_trace + def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> "_models.DiskRestorePoint": + """Get disk restorePoint resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the disk restore point created. + :type disk_restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskRestorePoint, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.DiskRestorePoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DiskRestorePoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + + + @distributed_trace + def list_by_restore_point( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskRestorePointList"]: + """Lists diskRestorePoints under a vmRestorePoint. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskRestorePointList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskRestorePointList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=self.list_by_restore_point.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_restore_point_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskRestorePointList", 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_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + + def _grant_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('AccessUri', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: + """Grants access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the disk restore point created. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. + :type grant_access_data: ~azure.mgmt.compute.v2021_08_01.models.GrantAccessData + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] + 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._grant_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AccessUri', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + + def _revoke_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + + + @distributed_trace + def begin_revoke_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Revokes access to a diskRestorePoint. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the disk restore point created. + :type disk_restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._revoke_access_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disks_operations.py new file mode 100644 index 000000000000..703fb6fea3a0 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disks_operations.py @@ -0,0 +1,1082 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + disk_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + +class DisksOperations(object): + """DisksOperations 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_08_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: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> "_models.Disk": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'Disk') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Disk', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Disk', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + disk: "_models.Disk", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. + :type disk: ~azure.mgmt.compute.v2021_08_01.models.Disk + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + 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, + disk_name=disk_name, + disk=disk, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Disk', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/disks/{diskName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> "_models.Disk": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(disk, 'DiskUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Disk', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Disk', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_name: str, + disk: "_models.DiskUpdate", + **kwargs: Any + ) -> LROPoller["_models.Disk"]: + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. + :type disk: ~azure.mgmt.compute.v2021_08_01.models.DiskUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + 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, + disk_name=disk_name, + disk=disk, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Disk', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/disks/{diskName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> "_models.Disk": + """Gets information about a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Disk, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.Disk + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Disk', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/disks/{diskName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + disk_name=disk_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/disks/{diskName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: + """Lists all the disks 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 DiskList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskList", 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/disks'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.DiskList"]: + """Lists all the disks under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskList", 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/disks'} # type: ignore + + def _grant_access_initial( + self, + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('AccessUri', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + disk_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. + :type grant_access_data: ~azure.mgmt.compute.v2021_08_01.models.GrantAccessData + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] + 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._grant_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AccessUri', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + + def _revoke_access_initial( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + disk_name=disk_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + + + @distributed_trace + def begin_revoke_access( + self, + resource_group_name: str, + disk_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Revokes access to a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. + :type disk_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._revoke_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_snapshots_operations.py new file mode 100644 index 000000000000..7197b9fe2f40 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_snapshots_operations.py @@ -0,0 +1,1082 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_grant_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_revoke_access_request_initial( + subscription_id: str, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + +class SnapshotsOperations(object): + """SnapshotsOperations 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_08_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: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> "_models.Snapshot": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'Snapshot') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Snapshot', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. + :type snapshot: ~azure.mgmt.compute.v2021_08_01.models.Snapshot + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + 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, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Snapshot', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/snapshots/{snapshotName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> "_models.Snapshot": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(snapshot, 'SnapshotUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Snapshot', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: "_models.SnapshotUpdate", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + :type snapshot: ~azure.mgmt.compute.v2021_08_01.models.SnapshotUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + 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, + snapshot_name=snapshot_name, + snapshot=snapshot, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Snapshot', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": + """Gets information about a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_08_01.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/snapshots/{snapshotName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + snapshot_name=snapshot_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: + """Lists snapshots 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 SnapshotList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotList", 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/snapshots'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.SnapshotList"]: + """Lists snapshots under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotList", 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/snapshots'} # type: ignore + + def _grant_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> Optional["_models.AccessUri"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccessUri"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(grant_access_data, 'GrantAccessData') + + request = build_grant_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._grant_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('AccessUri', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + + @distributed_trace + def begin_grant_access( + self, + resource_group_name: str, + snapshot_name: str, + grant_access_data: "_models.GrantAccessData", + **kwargs: Any + ) -> LROPoller["_models.AccessUri"]: + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. + :type grant_access_data: ~azure.mgmt.compute.v2021_08_01.models.GrantAccessData + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] + 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._grant_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + grant_access_data=grant_access_data, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AccessUri', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + + def _revoke_access_initial( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_revoke_access_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + template_url=self._revoke_access_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + + + @distributed_trace + def begin_revoke_access( + self, + resource_group_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Revokes access to a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._revoke_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/py.typed b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/setup.py b/sdk/compute/azure-mgmt-compute/setup.py index bfcfde7555e5..8f4ad1e95b9a 100644 --- a/sdk/compute/azure-mgmt-compute/setup.py +++ b/sdk/compute/azure-mgmt-compute/setup.py @@ -67,7 +67,7 @@ install_requires=[ 'msrest>=0.6.21', 'azure-common~=1.1', - 'azure-mgmt-core>=1.2.0,<2.0.0', + 'azure-mgmt-core>=1.3.0,<2.0.0', ], python_requires=">=3.7", ) diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_availability_sets.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_availability_sets.yaml index aa361afc777b..7dc9626b64d6 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_availability_sets.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_availability_sets.yaml @@ -14,7 +14,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/availabilitySets/availabilitysetse7f013f3?api-version=2021-07-01 @@ -32,7 +32,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:23:52 GMT + - Thu, 06 Jan 2022 07:20:02 GMT expires: - '-1' pragma: @@ -49,7 +49,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutVM3Min;693,Microsoft.Compute/PutVM30Min;3441 + - Microsoft.Compute/PutVM3Min;744,Microsoft.Compute/PutVM30Min;3728 x-ms-ratelimit-remaining-subscription-writes: - '1199' status: @@ -65,7 +65,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/availabilitySets/availabilitysetse7f013f3?api-version=2021-07-01 @@ -84,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:23:52 GMT + - Thu, 06 Jan 2022 07:20:02 GMT expires: - '-1' pragma: @@ -101,7 +101,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3751,Microsoft.Compute/LowCostGet30Min;31618 + - Microsoft.Compute/LowCostGet3Min;3999,Microsoft.Compute/LowCostGet30Min;31999 status: code: 200 message: OK @@ -120,7 +120,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/availabilitySets/availabilitysetse7f013f3?api-version=2021-07-01 @@ -138,7 +138,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:23:52 GMT + - Thu, 06 Jan 2022 07:20:02 GMT expires: - '-1' pragma: @@ -155,7 +155,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutVM3Min;692,Microsoft.Compute/PutVM30Min;3440 + - Microsoft.Compute/PutVM3Min;743,Microsoft.Compute/PutVM30Min;3727 x-ms-ratelimit-remaining-subscription-writes: - '1198' status: @@ -173,7 +173,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/availabilitySets/availabilitysetse7f013f3?api-version=2021-07-01 @@ -186,7 +186,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 06:23:55 GMT + - Thu, 06 Jan 2022 07:20:04 GMT expires: - '-1' pragma: @@ -199,7 +199,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteVM3Min;235,Microsoft.Compute/DeleteVM30Min;1195 + - Microsoft.Compute/DeleteVM3Min;239,Microsoft.Compute/DeleteVM30Min;1199 x-ms-ratelimit-remaining-subscription-deletes: - '14999' status: diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_log_analytics.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_log_analytics.yaml index ee9f170736ed..8cacb51b69ee 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_log_analytics.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_log_analytics.yaml @@ -16,7 +16,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-storage/19.0.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-storage/19.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/accountxyz9b271243?api-version=2021-06-01 @@ -31,11 +31,11 @@ interactions: content-type: - text/plain; charset=utf-8 date: - - Tue, 12 Oct 2021 06:24:03 GMT + - Thu, 06 Jan 2022 07:20:09 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus/asyncoperations/17f37b1f-13cd-4340-b2de-d232f224195a?monitor=true&api-version=2021-06-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus/asyncoperations/1f4e56b6-bf0c-4afd-a12a-32b3137c21a8?monitor=true&api-version=2021-06-01 pragma: - no-cache server: @@ -59,13 +59,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-storage/19.0.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-storage/19.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus/asyncoperations/17f37b1f-13cd-4340-b2de-d232f224195a?monitor=true&api-version=2021-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus/asyncoperations/1f4e56b6-bf0c-4afd-a12a-32b3137c21a8?monitor=true&api-version=2021-06-01 response: body: - string: '{"sku":{"name":"Standard_GRS","tier":"Standard"},"kind":"StorageV2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/accountxyz9b271243","name":"accountxyz9b271243","type":"Microsoft.Storage/storageAccounts","location":"eastus","tags":{"key1":"value1","key2":"value2"},"properties":{"keyCreationTime":{"key1":"2021-10-12T06:24:01.9817837Z","key2":"2021-10-12T06:24:01.9817837Z"},"privateEndpointConnections":[],"minimumTlsVersion":"TLS1_0","allowBlobPublicAccess":true,"networkAcls":{"bypass":"AzureServices","virtualNetworkRules":[],"ipRules":[],"defaultAction":"Allow"},"supportsHttpsTrafficOnly":true,"encryption":{"services":{"file":{"keyType":"Account","enabled":true,"lastEnabledTime":"2021-10-12T06:24:01.9817837Z"},"blob":{"keyType":"Account","enabled":true,"lastEnabledTime":"2021-10-12T06:24:01.9817837Z"}},"keySource":"Microsoft.Storage"},"accessTier":"Hot","provisioningState":"Succeeded","creationTime":"2021-10-12T06:24:01.6849029Z","primaryEndpoints":{"dfs":"https://accountxyz9b271243.dfs.core.windows.net/","web":"https://accountxyz9b271243.z13.web.core.windows.net/","blob":"https://accountxyz9b271243.blob.core.windows.net/","queue":"https://accountxyz9b271243.queue.core.windows.net/","table":"https://accountxyz9b271243.table.core.windows.net/","file":"https://accountxyz9b271243.file.core.windows.net/"},"primaryLocation":"eastus","statusOfPrimary":"available","secondaryLocation":"westus","statusOfSecondary":"available"}}' + string: '{"sku":{"name":"Standard_GRS","tier":"Standard"},"kind":"StorageV2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/accountxyz9b271243","name":"accountxyz9b271243","type":"Microsoft.Storage/storageAccounts","location":"eastus","tags":{"key1":"value1","key2":"value2"},"properties":{"keyCreationTime":{"key1":"2022-01-06T07:20:08.4737000Z","key2":"2022-01-06T07:20:08.4737000Z"},"privateEndpointConnections":[],"minimumTlsVersion":"TLS1_0","allowBlobPublicAccess":true,"networkAcls":{"bypass":"AzureServices","virtualNetworkRules":[],"ipRules":[],"defaultAction":"Allow"},"supportsHttpsTrafficOnly":true,"encryption":{"services":{"file":{"keyType":"Account","enabled":true,"lastEnabledTime":"2022-01-06T07:20:08.4737000Z"},"blob":{"keyType":"Account","enabled":true,"lastEnabledTime":"2022-01-06T07:20:08.4737000Z"}},"keySource":"Microsoft.Storage"},"accessTier":"Hot","provisioningState":"Succeeded","creationTime":"2022-01-06T07:20:08.3174877Z","primaryEndpoints":{"dfs":"https://accountxyz9b271243.dfs.core.windows.net/","web":"https://accountxyz9b271243.z13.web.core.windows.net/","blob":"https://accountxyz9b271243.blob.core.windows.net/","queue":"https://accountxyz9b271243.queue.core.windows.net/","table":"https://accountxyz9b271243.table.core.windows.net/","file":"https://accountxyz9b271243.file.core.windows.net/"},"primaryLocation":"eastus","statusOfPrimary":"available","secondaryLocation":"westus","statusOfSecondary":"available"}}' headers: cache-control: - no-cache @@ -74,7 +74,7 @@ interactions: content-type: - application/json date: - - Tue, 12 Oct 2021 06:24:20 GMT + - Thu, 06 Jan 2022 07:20:26 GMT expires: - '-1' pragma: @@ -104,13 +104,13 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-storage/19.0.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-storage/19.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/accountxyz9b271243/listKeys?api-version=2021-06-01&$expand=kerb response: body: - string: '{"keys":[{"creationTime":"2021-10-12T06:24:01.9817837Z","keyName":"key1","value":"FakeValue","permissions":"FULL"},{"creationTime":"2021-10-12T06:24:01.9817837Z","keyName":"key2","value":"FakeValue","permissions":"FULL"}]}' + string: '{"keys":[{"creationTime":"2022-01-06T07:20:08.4737000Z","keyName":"key1","value":"FakeValue","permissions":"FULL"},{"creationTime":"2022-01-06T07:20:08.4737000Z","keyName":"key2","value":"FakeValue","permissions":"FULL"}]}' headers: cache-control: - no-cache @@ -119,7 +119,7 @@ interactions: content-type: - application/json date: - - Tue, 12 Oct 2021 06:24:20 GMT + - Thu, 06 Jan 2022 07:20:26 GMT expires: - '-1' pragma: @@ -140,8 +140,8 @@ interactions: code: 200 message: OK - request: - body: '{"blobContainerSasUri": "fakeuri", "fromTime": "2021-10-10T06:24:21.688456Z", - "toTime": "2021-10-12T06:24:21.688461Z", "groupByResourceName": true, "intervalLength": + body: '{"blobContainerSasUri": "fakeuri", "fromTime": "2022-01-04T07:20:27.013069Z", + "toTime": "2022-01-06T07:20:27.013074Z", "groupByResourceName": true, "intervalLength": "SixtyMins"}' headers: Accept: @@ -155,7 +155,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/logAnalytics/apiAccess/getRequestRateByInterval?api-version=2021-07-01 @@ -164,17 +164,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/b128023f-7dc3-4aaf-bf46-fa84cdf1298d?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/68ce4ef2-f8ca-43e0-a796-45e6843990bc?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:24:21 GMT + - Thu, 06 Jan 2022 07:20:27 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/b128023f-7dc3-4aaf-bf46-fa84cdf1298d?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/68ce4ef2-f8ca-43e0-a796-45e6843990bc?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -201,17 +201,17 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/b128023f-7dc3-4aaf-bf46-fa84cdf1298d?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/68ce4ef2-f8ca-43e0-a796-45e6843990bc?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:24:22.3402304+00:00\",\r\n \"endTime\": - \"2021-10-12T06:24:26.6683967+00:00\",\r\n \"status\": \"Failed\",\r\n \"error\": + string: "{\r\n \"startTime\": \"2022-01-06T07:20:27.3477152+00:00\",\r\n \"endTime\": + \"2022-01-06T07:20:29.6758167+00:00\",\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"Could not write log analytics to the given SAS URI due to The remote server returned an error: - (403) Forbidden..\"\r\n },\r\n \"name\": \"b128023f-7dc3-4aaf-bf46-fa84cdf1298d\"\r\n}" + (403) Forbidden..\"\r\n },\r\n \"name\": \"68ce4ef2-f8ca-43e0-a796-45e6843990bc\"\r\n}" headers: cache-control: - no-cache @@ -220,7 +220,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:24:52 GMT + - Thu, 06 Jan 2022 07:20:56 GMT expires: - '-1' pragma: @@ -237,13 +237,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29873 + - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29998 status: code: 200 message: OK - request: - body: '{"blobContainerSasUri": "fakeuri", "fromTime": "2021-10-10T06:24:52.667871Z", - "toTime": "2021-10-12T06:24:52.66788Z", "groupByOperationName": true, "groupByResourceName": + body: '{"blobContainerSasUri": "fakeuri", "fromTime": "2022-01-04T07:20:57.534088Z", + "toTime": "2022-01-06T07:20:57.534102Z", "groupByOperationName": true, "groupByResourceName": false}' headers: Accept: @@ -253,11 +253,11 @@ interactions: Connection: - keep-alive Content-Length: - - '360' + - '361' Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/logAnalytics/apiAccess/getThrottledRequests?api-version=2021-07-01 @@ -266,17 +266,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/751fb06d-ef28-4964-9f4b-2e9b91f56321?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7a7c5bdf-d240-4bc3-89c7-a2fa15bd827c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:24:52 GMT + - Thu, 06 Jan 2022 07:20:57 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/751fb06d-ef28-4964-9f4b-2e9b91f56321?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7a7c5bdf-d240-4bc3-89c7-a2fa15bd827c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -303,26 +303,26 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/751fb06d-ef28-4964-9f4b-2e9b91f56321?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7a7c5bdf-d240-4bc3-89c7-a2fa15bd827c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:24:52.777901+00:00\",\r\n \"endTime\": - \"2021-10-12T06:24:53.2623224+00:00\",\r\n \"status\": \"Failed\",\r\n \"error\": + string: "{\r\n \"startTime\": \"2022-01-06T07:20:57.5820701+00:00\",\r\n \"endTime\": + \"2022-01-06T07:20:58.1133188+00:00\",\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"Could not write log analytics to the given SAS URI due to The remote server returned an error: - (403) Forbidden..\"\r\n },\r\n \"name\": \"751fb06d-ef28-4964-9f4b-2e9b91f56321\"\r\n}" + (403) Forbidden..\"\r\n },\r\n \"name\": \"7a7c5bdf-d240-4bc3-89c7-a2fa15bd827c\"\r\n}" headers: cache-control: - no-cache content-length: - - '358' + - '359' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:22 GMT + - Thu, 06 Jan 2022 07:21:26 GMT expires: - '-1' pragma: @@ -339,7 +339,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29870 + - Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29996 status: code: 200 message: OK diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_proximity_placement_groups.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_proximity_placement_groups.yaml index 6638da84a133..be5cd396b111 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_proximity_placement_groups.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute.test_compute_proximity_placement_groups.yaml @@ -13,7 +13,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/proximityPlacementGroups/proximiityplacementgroupsb24517e6?api-version=2021-07-01 @@ -32,7 +32,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:26 GMT + - Thu, 06 Jan 2022 07:21:30 GMT expires: - '-1' pragma: @@ -61,7 +61,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/proximityPlacementGroups/proximiityplacementgroupsb24517e6?api-version=2021-07-01 @@ -81,7 +81,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:26 GMT + - Thu, 06 Jan 2022 07:21:30 GMT expires: - '-1' pragma: @@ -116,7 +116,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/proximityPlacementGroups/proximiityplacementgroupsb24517e6?api-version=2021-07-01 @@ -135,7 +135,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:26 GMT + - Thu, 06 Jan 2022 07:21:30 GMT expires: - '-1' pragma: @@ -170,7 +170,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/proximityPlacementGroups/proximiityplacementgroupsb24517e6?api-version=2021-07-01 @@ -183,7 +183,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 06:25:29 GMT + - Thu, 06 Jan 2022 07:21:31 GMT expires: - '-1' pragma: diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks.yaml index 2a677e668a7f..82e6a734e057 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks.yaml @@ -14,10 +14,10 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"disknamex77f61175\",\r\n \"location\": \"eastus\",\r\n @@ -26,7 +26,7 @@ interactions: \"Updating\",\r\n \"isArmResource\": true\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/0144e615-7956-4a63-88f9-900e48690e95?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8e6959a6-4c74-4560-b3de-fcbeff7db813?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: @@ -34,11 +34,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:14 GMT + - Thu, 06 Jan 2022 07:23:12 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/0144e615-7956-4a63-88f9-900e48690e95?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8e6959a6-4c74-4560-b3de-fcbeff7db813?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -65,14 +65,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/0144e615-7956-4a63-88f9-900e48690e95?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8e6959a6-4c74-4560-b3de-fcbeff7db813?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:27:15.6373292+00:00\",\r\n \"endTime\": - \"2021-10-12T06:27:15.715421+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:23:13.07973+00:00\",\r\n \"endTime\": + \"2022-01-06T07:23:13.2203716+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"disknamex77f61175\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175\",\r\n \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus\",\r\n @@ -82,19 +82,19 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:27:15.6373292+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:23:13.0953499+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"7017fb16-747b-44fc-af6c-a50f6a0fe24e\"\r\n }\r\n}\r\n - \ },\r\n \"name\": \"0144e615-7956-4a63-88f9-900e48690e95\"\r\n}" + \ \"uniqueId\": \"8f68b30d-5b38-478d-bb3a-1b992da1fa98\"\r\n }\r\n}\r\n + \ },\r\n \"name\": \"8e6959a6-4c74-4560-b3de-fcbeff7db813\"\r\n}" headers: cache-control: - no-cache content-length: - - '1154' + - '1153' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:17 GMT + - Thu, 06 Jan 2022 07:23:14 GMT expires: - '-1' pragma: @@ -111,7 +111,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49985,Microsoft.Compute/GetOperation30Min;399976 + - Microsoft.Compute/GetOperation3Min;49988,Microsoft.Compute/GetOperation30Min;399988 status: code: 200 message: OK @@ -125,10 +125,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"disknamex77f61175\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175\",\r\n @@ -139,9 +139,9 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:27:15.6373292+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:23:13.0953499+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"7017fb16-747b-44fc-af6c-a50f6a0fe24e\"\r\n }\r\n}" + \ \"uniqueId\": \"8f68b30d-5b38-478d-bb3a-1b992da1fa98\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -150,7 +150,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:17 GMT + - Thu, 06 Jan 2022 07:23:14 GMT expires: - '-1' pragma: @@ -167,7 +167,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14990,Microsoft.Compute/LowCostGet30Min;119926 + - Microsoft.Compute/LowCostGet3Min;14991,Microsoft.Compute/LowCostGet30Min;119991 status: code: 200 message: OK @@ -181,10 +181,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"disknamex77f61175\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175\",\r\n @@ -195,9 +195,9 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:27:15.6373292+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:23:13.0953499+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"7017fb16-747b-44fc-af6c-a50f6a0fe24e\"\r\n }\r\n}" + \ \"uniqueId\": \"8f68b30d-5b38-478d-bb3a-1b992da1fa98\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -206,7 +206,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:18 GMT + - Thu, 06 Jan 2022 07:23:14 GMT expires: - '-1' pragma: @@ -223,7 +223,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14989,Microsoft.Compute/LowCostGet30Min;119925 + - Microsoft.Compute/LowCostGet3Min;14990,Microsoft.Compute/LowCostGet30Min;119990 status: code: 200 message: OK @@ -241,32 +241,33 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"disknamex77f61175\",\r\n \"location\": \"eastus\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 200,\r\n \"provisioningState\": - \"Updating\",\r\n \"isArmResource\": true\r\n }\r\n}" + \"Updating\",\r\n \"isArmResource\": true,\r\n \"colocationConstraints\": + {}\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/da3016f2-f263-436f-a9bb-c68181fbfe6f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/58593b11-e763-47a9-bc3c-6ac39ff5c1ab?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - - '307' + - '341' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:18 GMT + - Thu, 06 Jan 2022 07:23:14 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/da3016f2-f263-436f-a9bb-c68181fbfe6f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/58593b11-e763-47a9-bc3c-6ac39ff5c1ab?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -293,14 +294,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/da3016f2-f263-436f-a9bb-c68181fbfe6f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/58593b11-e763-47a9-bc3c-6ac39ff5c1ab?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:27:18.1842093+00:00\",\r\n \"endTime\": - \"2021-10-12T06:27:18.2779385+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:23:15.3141644+00:00\",\r\n \"endTime\": + \"2022-01-06T07:23:15.4390972+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"disknamex77f61175\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175\",\r\n \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus\",\r\n @@ -310,10 +311,10 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:27:15.6373292+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:23:13.0953499+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"7017fb16-747b-44fc-af6c-a50f6a0fe24e\"\r\n }\r\n}\r\n - \ },\r\n \"name\": \"da3016f2-f263-436f-a9bb-c68181fbfe6f\"\r\n}" + \ \"uniqueId\": \"8f68b30d-5b38-478d-bb3a-1b992da1fa98\"\r\n }\r\n}\r\n + \ },\r\n \"name\": \"58593b11-e763-47a9-bc3c-6ac39ff5c1ab\"\r\n}" headers: cache-control: - no-cache @@ -322,7 +323,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:20 GMT + - Thu, 06 Jan 2022 07:23:16 GMT expires: - '-1' pragma: @@ -339,7 +340,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49984,Microsoft.Compute/GetOperation30Min;399975 + - Microsoft.Compute/GetOperation3Min;49987,Microsoft.Compute/GetOperation30Min;399987 status: code: 200 message: OK @@ -353,10 +354,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"disknamex77f61175\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175\",\r\n @@ -367,9 +368,9 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:27:15.6373292+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:23:13.0953499+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"7017fb16-747b-44fc-af6c-a50f6a0fe24e\"\r\n }\r\n}" + \ \"uniqueId\": \"8f68b30d-5b38-478d-bb3a-1b992da1fa98\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -378,7 +379,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:20 GMT + - Thu, 06 Jan 2022 07:23:16 GMT expires: - '-1' pragma: @@ -395,7 +396,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14987,Microsoft.Compute/LowCostGet30Min;119923 + - Microsoft.Compute/LowCostGet3Min;14988,Microsoft.Compute/LowCostGet30Min;119988 status: code: 200 message: OK @@ -413,26 +414,26 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175/beginGetAccess?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175/beginGetAccess?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/556b6058-a21a-4b3c-9c3d-9641aa6ac3be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/239f307d-f4e9-479e-84fe-780b07db4c77?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:27:20 GMT + - Thu, 06 Jan 2022 07:23:16 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/556b6058-a21a-4b3c-9c3d-9641aa6ac3be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/239f307d-f4e9-479e-84fe-780b07db4c77?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -459,25 +460,25 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/556b6058-a21a-4b3c-9c3d-9641aa6ac3be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/239f307d-f4e9-479e-84fe-780b07db4c77?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:27:20.6529784+00:00\",\r\n \"endTime\": - \"2021-10-12T06:27:20.9498506+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:23:17.5016353+00:00\",\r\n \"endTime\": + \"2022-01-06T07:23:17.8610251+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"accessSAS\": \"FakeUrl\"\r\n}\r\n - \ },\r\n \"name\": \"556b6058-a21a-4b3c-9c3d-9641aa6ac3be\"\r\n}" + \ },\r\n \"name\": \"239f307d-f4e9-479e-84fe-780b07db4c77\"\r\n}" headers: cache-control: - no-cache content-length: - - '432' + - '436' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:50 GMT + - Thu, 06 Jan 2022 07:23:47 GMT expires: - '-1' pragma: @@ -494,7 +495,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49982,Microsoft.Compute/GetOperation30Min;399972 + - Microsoft.Compute/GetOperation3Min;49984,Microsoft.Compute/GetOperation30Min;399984 status: code: 200 message: OK @@ -508,10 +509,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/556b6058-a21a-4b3c-9c3d-9641aa6ac3be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/239f307d-f4e9-479e-84fe-780b07db4c77?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 response: body: string: "{\r\n \"accessSAS\": \"FakeUrl\"\r\n}" @@ -519,11 +520,11 @@ interactions: cache-control: - no-cache content-length: - - '207' + - '211' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:50 GMT + - Thu, 06 Jan 2022 07:23:47 GMT expires: - '-1' pragma: @@ -540,7 +541,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49981,Microsoft.Compute/GetOperation30Min;399971 + - Microsoft.Compute/GetOperation3Min;49983,Microsoft.Compute/GetOperation30Min;399983 status: code: 200 message: OK @@ -556,26 +557,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175/endGetAccess?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175/endGetAccess?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/cfec0a0f-879b-45b5-a167-89e59941daac?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b1d7396d-f791-4bad-8ab4-1ea0ea641885?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:27:50 GMT + - Thu, 06 Jan 2022 07:23:47 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/cfec0a0f-879b-45b5-a167-89e59941daac?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b1d7396d-f791-4bad-8ab4-1ea0ea641885?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -602,15 +603,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/cfec0a0f-879b-45b5-a167-89e59941daac?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b1d7396d-f791-4bad-8ab4-1ea0ea641885?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:27:51.1690379+00:00\",\r\n \"endTime\": - \"2021-10-12T06:27:51.2784114+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"cfec0a0f-879b-45b5-a167-89e59941daac\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:23:47.7518371+00:00\",\r\n \"endTime\": + \"2022-01-06T07:23:47.9080767+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"b1d7396d-f791-4bad-8ab4-1ea0ea641885\"\r\n}" headers: cache-control: - no-cache @@ -619,7 +620,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:28:20 GMT + - Thu, 06 Jan 2022 07:24:17 GMT expires: - '-1' pragma: @@ -636,7 +637,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49981,Microsoft.Compute/GetOperation30Min;399969 + - Microsoft.Compute/GetOperation3Min;49981,Microsoft.Compute/GetOperation30Min;399981 status: code: 200 message: OK @@ -650,10 +651,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/cfec0a0f-879b-45b5-a167-89e59941daac?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b1d7396d-f791-4bad-8ab4-1ea0ea641885?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 response: body: string: '' @@ -663,7 +664,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 06:28:20 GMT + - Thu, 06 Jan 2022 07:24:17 GMT expires: - '-1' pragma: @@ -676,7 +677,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49980,Microsoft.Compute/GetOperation30Min;399968 + - Microsoft.Compute/GetOperation3Min;49980,Microsoft.Compute/GetOperation30Min;399980 status: code: 200 message: OK @@ -692,26 +693,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex77f61175?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/06c9134d-0a5b-461f-9e22-8ba8af29677f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/68651795-82a3-4fe8-a87b-c0e7c85fa201?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:28:21 GMT + - Thu, 06 Jan 2022 07:24:17 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/06c9134d-0a5b-461f-9e22-8ba8af29677f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/68651795-82a3-4fe8-a87b-c0e7c85fa201?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -722,7 +723,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteDisks3Min;2998,Microsoft.Compute/DeleteDisks30Min;23994 + - Microsoft.Compute/DeleteDisks3Min;2998,Microsoft.Compute/DeleteDisks30Min;23998 x-ms-ratelimit-remaining-subscription-deletes: - '14997' status: @@ -738,15 +739,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/06c9134d-0a5b-461f-9e22-8ba8af29677f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/68651795-82a3-4fe8-a87b-c0e7c85fa201?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:28:21.7784176+00:00\",\r\n \"endTime\": - \"2021-10-12T06:28:21.9971559+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"06c9134d-0a5b-461f-9e22-8ba8af29677f\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:24:17.9864532+00:00\",\r\n \"endTime\": + \"2022-01-06T07:24:18.2832765+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"68651795-82a3-4fe8-a87b-c0e7c85fa201\"\r\n}" headers: cache-control: - no-cache @@ -755,7 +756,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:28:51 GMT + - Thu, 06 Jan 2022 07:24:47 GMT expires: - '-1' pragma: @@ -772,7 +773,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49982,Microsoft.Compute/GetOperation30Min;399966 + - Microsoft.Compute/GetOperation3Min;49982,Microsoft.Compute/GetOperation30Min;399978 status: code: 200 message: OK diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks_multi.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks_multi.yaml index b5ff41dee093..350e68da8fc3 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks_multi.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_disks_multi.yaml @@ -14,7 +14,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff?api-version=2019-03-01 @@ -26,7 +26,7 @@ interactions: \"Updating\",\r\n \"isArmResource\": true\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/09f86008-27e6-4464-977d-4ca9d809910c?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/a89f2a03-0efc-417e-8416-e16970c664a2?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 cache-control: - no-cache content-length: @@ -34,11 +34,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:34 GMT + - Thu, 06 Jan 2022 07:21:35 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/09f86008-27e6-4464-977d-4ca9d809910c?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/a89f2a03-0efc-417e-8416-e16970c664a2?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 pragma: - no-cache server: @@ -65,33 +65,33 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/09f86008-27e6-4464-977d-4ca9d809910c?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/a89f2a03-0efc-417e-8416-e16970c664a2?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:25:35.4332759+00:00\",\r\n \"endTime\": - \"2021-10-12T06:25:35.511365+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:21:35.5947367+00:00\",\r\n \"endTime\": + \"2022-01-06T07:21:35.7353125+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"disknamexe97813ff\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff\",\r\n \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 200,\r\n \"diskIOPSReadWrite\": - 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2021-10-12T06:25:35.4332759+00:00\",\r\n + 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2022-01-06T07:21:35.6103479+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"62852463-1861-486f-9243-2e0d4e89cec7\"\r\n - \ }\r\n}\r\n },\r\n \"name\": \"09f86008-27e6-4464-977d-4ca9d809910c\"\r\n}" + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"4815d48b-f7ae-47f2-9537-8633c499bc57\"\r\n + \ }\r\n}\r\n },\r\n \"name\": \"a89f2a03-0efc-417e-8416-e16970c664a2\"\r\n}" headers: cache-control: - no-cache content-length: - - '997' + - '998' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:37 GMT + - Thu, 06 Jan 2022 07:21:37 GMT expires: - '-1' pragma: @@ -108,7 +108,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49990,Microsoft.Compute/GetOperation30Min;399987 + - Microsoft.Compute/GetOperation3Min;49999,Microsoft.Compute/GetOperation30Min;399999 status: code: 200 message: OK @@ -122,7 +122,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff?api-version=2019-03-01 @@ -133,9 +133,9 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 200,\r\n \"diskIOPSReadWrite\": - 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2021-10-12T06:25:35.4332759+00:00\",\r\n + 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2022-01-06T07:21:35.6103479+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"62852463-1861-486f-9243-2e0d4e89cec7\"\r\n + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"4815d48b-f7ae-47f2-9537-8633c499bc57\"\r\n \ }\r\n}" headers: cache-control: @@ -145,7 +145,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:37 GMT + - Thu, 06 Jan 2022 07:21:37 GMT expires: - '-1' pragma: @@ -162,7 +162,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14996,Microsoft.Compute/LowCostGet30Min;119934 + - Microsoft.Compute/LowCostGet3Min;14999,Microsoft.Compute/LowCostGet30Min;119999 status: code: 200 message: OK @@ -176,7 +176,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff?api-version=2019-03-01 @@ -187,9 +187,9 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 200,\r\n \"diskIOPSReadWrite\": - 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2021-10-12T06:25:35.4332759+00:00\",\r\n + 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2022-01-06T07:21:35.6103479+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"62852463-1861-486f-9243-2e0d4e89cec7\"\r\n + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"4815d48b-f7ae-47f2-9537-8633c499bc57\"\r\n \ }\r\n}" headers: cache-control: @@ -199,7 +199,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:37 GMT + - Thu, 06 Jan 2022 07:21:37 GMT expires: - '-1' pragma: @@ -216,7 +216,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14995,Microsoft.Compute/LowCostGet30Min;119933 + - Microsoft.Compute/LowCostGet3Min;14998,Microsoft.Compute/LowCostGet30Min;119998 status: code: 200 message: OK @@ -234,7 +234,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff?api-version=2019-03-01 @@ -244,22 +244,23 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 200,\r\n \"provisioningState\": - \"Updating\",\r\n \"isArmResource\": true\r\n }\r\n}" + \"Updating\",\r\n \"isArmResource\": true,\r\n \"colocationConstraints\": + {}\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/327c07f7-5a8b-43c0-adb2-2f650df7289f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/df0ea1a3-da7e-4e39-bafe-323eb765d1aa?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 cache-control: - no-cache content-length: - - '307' + - '341' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:37 GMT + - Thu, 06 Jan 2022 07:21:37 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/327c07f7-5a8b-43c0-adb2-2f650df7289f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/df0ea1a3-da7e-4e39-bafe-323eb765d1aa?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 pragma: - no-cache server: @@ -286,33 +287,33 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/327c07f7-5a8b-43c0-adb2-2f650df7289f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/df0ea1a3-da7e-4e39-bafe-323eb765d1aa?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:25:37.9801466+00:00\",\r\n \"endTime\": - \"2021-10-12T06:25:38.1051139+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:21:37.844699+00:00\",\r\n \"endTime\": + \"2022-01-06T07:21:37.9697281+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"disknamexe97813ff\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff\",\r\n \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 200,\r\n \"diskIOPSReadWrite\": - 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2021-10-12T06:25:35.4332759+00:00\",\r\n + 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2022-01-06T07:21:35.6103479+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"62852463-1861-486f-9243-2e0d4e89cec7\"\r\n - \ }\r\n}\r\n },\r\n \"name\": \"327c07f7-5a8b-43c0-adb2-2f650df7289f\"\r\n}" + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"4815d48b-f7ae-47f2-9537-8633c499bc57\"\r\n + \ }\r\n}\r\n },\r\n \"name\": \"df0ea1a3-da7e-4e39-bafe-323eb765d1aa\"\r\n}" headers: cache-control: - no-cache content-length: - - '998' + - '997' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:39 GMT + - Thu, 06 Jan 2022 07:21:39 GMT expires: - '-1' pragma: @@ -329,7 +330,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49989,Microsoft.Compute/GetOperation30Min;399986 + - Microsoft.Compute/GetOperation3Min;49998,Microsoft.Compute/GetOperation30Min;399998 status: code: 200 message: OK @@ -343,7 +344,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff?api-version=2019-03-01 @@ -354,9 +355,9 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 200,\r\n \"diskIOPSReadWrite\": - 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2021-10-12T06:25:35.4332759+00:00\",\r\n + 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"timeCreated\": \"2022-01-06T07:21:35.6103479+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"62852463-1861-486f-9243-2e0d4e89cec7\"\r\n + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"4815d48b-f7ae-47f2-9537-8633c499bc57\"\r\n \ }\r\n}" headers: cache-control: @@ -366,7 +367,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:25:39 GMT + - Thu, 06 Jan 2022 07:21:39 GMT expires: - '-1' pragma: @@ -383,7 +384,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119931 + - Microsoft.Compute/LowCostGet3Min;14996,Microsoft.Compute/LowCostGet30Min;119996 status: code: 200 message: OK @@ -401,7 +402,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff/beginGetAccess?api-version=2019-03-01 @@ -410,17 +411,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b9f203cf-295e-426c-b4a3-460aab14c852?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/97930cb0-64f1-435c-9968-cfc7e0af8818?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:25:39 GMT + - Thu, 06 Jan 2022 07:21:39 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b9f203cf-295e-426c-b4a3-460aab14c852?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/97930cb0-64f1-435c-9968-cfc7e0af8818?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 pragma: - no-cache server: @@ -447,25 +448,25 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b9f203cf-295e-426c-b4a3-460aab14c852?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/97930cb0-64f1-435c-9968-cfc7e0af8818?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:25:40.4019968+00:00\",\r\n \"endTime\": - \"2021-10-12T06:25:40.7301408+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:21:40.0166243+00:00\",\r\n \"endTime\": + \"2022-01-06T07:21:40.5165962+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"accessSAS\": \"FakeUrl\"\r\n}\r\n - \ },\r\n \"name\": \"b9f203cf-295e-426c-b4a3-460aab14c852\"\r\n}" + \ },\r\n \"name\": \"97930cb0-64f1-435c-9968-cfc7e0af8818\"\r\n}" headers: cache-control: - no-cache content-length: - - '430' + - '429' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:26:09 GMT + - Thu, 06 Jan 2022 07:22:09 GMT expires: - '-1' pragma: @@ -482,7 +483,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49989,Microsoft.Compute/GetOperation30Min;399983 + - Microsoft.Compute/GetOperation3Min;49995,Microsoft.Compute/GetOperation30Min;399995 status: code: 200 message: OK @@ -496,10 +497,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b9f203cf-295e-426c-b4a3-460aab14c852?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/97930cb0-64f1-435c-9968-cfc7e0af8818?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 response: body: string: "{\r\n \"accessSAS\": \"FakeUrl\"\r\n}" @@ -507,11 +508,11 @@ interactions: cache-control: - no-cache content-length: - - '205' + - '204' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:26:09 GMT + - Thu, 06 Jan 2022 07:22:09 GMT expires: - '-1' pragma: @@ -528,7 +529,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49988,Microsoft.Compute/GetOperation30Min;399982 + - Microsoft.Compute/GetOperation3Min;49994,Microsoft.Compute/GetOperation30Min;399994 status: code: 200 message: OK @@ -544,7 +545,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff/endGetAccess?api-version=2019-03-01 @@ -553,17 +554,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/a4834cd9-886b-4dc0-a5b3-d9e5a58cc456?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/edca157b-07e2-4572-a1cc-4622dfc8d879?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:26:10 GMT + - Thu, 06 Jan 2022 07:22:09 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/a4834cd9-886b-4dc0-a5b3-d9e5a58cc456?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/edca157b-07e2-4572-a1cc-4622dfc8d879?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 pragma: - no-cache server: @@ -590,24 +591,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/a4834cd9-886b-4dc0-a5b3-d9e5a58cc456?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/edca157b-07e2-4572-a1cc-4622dfc8d879?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:26:10.8552559+00:00\",\r\n \"endTime\": - \"2021-10-12T06:26:10.949024+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"a4834cd9-886b-4dc0-a5b3-d9e5a58cc456\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:22:10.3293039+00:00\",\r\n \"endTime\": + \"2022-01-06T07:22:10.4855711+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"edca157b-07e2-4572-a1cc-4622dfc8d879\"\r\n}" headers: cache-control: - no-cache content-length: - - '183' + - '184' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:26:40 GMT + - Thu, 06 Jan 2022 07:22:40 GMT expires: - '-1' pragma: @@ -624,7 +625,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49988,Microsoft.Compute/GetOperation30Min;399980 + - Microsoft.Compute/GetOperation3Min;49992,Microsoft.Compute/GetOperation30Min;399992 status: code: 200 message: OK @@ -638,10 +639,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/a4834cd9-886b-4dc0-a5b3-d9e5a58cc456?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/edca157b-07e2-4572-a1cc-4622dfc8d879?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 response: body: string: '' @@ -651,7 +652,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 06:26:41 GMT + - Thu, 06 Jan 2022 07:22:40 GMT expires: - '-1' pragma: @@ -664,7 +665,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49987,Microsoft.Compute/GetOperation30Min;399979 + - Microsoft.Compute/GetOperation3Min;49991,Microsoft.Compute/GetOperation30Min;399991 status: code: 200 message: OK @@ -680,7 +681,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamexe97813ff?api-version=2019-03-01 @@ -689,17 +690,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/30fff933-f063-48f4-9707-e172b7619e45?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/6dda0cac-9fa2-4130-b852-6b6ba41dc194?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:26:41 GMT + - Thu, 06 Jan 2022 07:22:40 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/30fff933-f063-48f4-9707-e172b7619e45?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/6dda0cac-9fa2-4130-b852-6b6ba41dc194?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2019-03-01 pragma: - no-cache server: @@ -710,7 +711,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteDisks3Min;2998,Microsoft.Compute/DeleteDisks30Min;23995 + - Microsoft.Compute/DeleteDisks3Min;2999,Microsoft.Compute/DeleteDisks30Min;23999 x-ms-ratelimit-remaining-subscription-deletes: - '14999' status: @@ -726,15 +727,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/30fff933-f063-48f4-9707-e172b7619e45?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/6dda0cac-9fa2-4130-b852-6b6ba41dc194?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2019-03-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:26:41.4990321+00:00\",\r\n \"endTime\": - \"2021-10-12T06:26:41.7153055+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"30fff933-f063-48f4-9707-e172b7619e45\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:22:40.5638853+00:00\",\r\n \"endTime\": + \"2022-01-06T07:22:40.8294917+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"6dda0cac-9fa2-4130-b852-6b6ba41dc194\"\r\n}" headers: cache-control: - no-cache @@ -743,7 +744,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:27:11 GMT + - Thu, 06 Jan 2022 07:23:09 GMT expires: - '-1' pragma: @@ -760,7 +761,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49986,Microsoft.Compute/GetOperation30Min;399977 + - Microsoft.Compute/GetOperation3Min;49989,Microsoft.Compute/GetOperation30Min;399989 status: code: 200 message: OK diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_shot.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_shot.yaml index c5a1774c1fa7..4bf1379ae9d7 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_shot.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_disks.test_compute_shot.yaml @@ -14,10 +14,10 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"disknamex66bb1115\",\r\n \"location\": \"eastus\",\r\n @@ -26,7 +26,7 @@ interactions: \"Updating\",\r\n \"isArmResource\": true\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/e2cc3f0f-ce8d-4833-bed1-8367e410a3ac?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/237dc6c4-cd11-4d45-ba06-754498665c78?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: @@ -34,11 +34,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:28:55 GMT + - Thu, 06 Jan 2022 07:24:51 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/e2cc3f0f-ce8d-4833-bed1-8367e410a3ac?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/237dc6c4-cd11-4d45-ba06-754498665c78?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -65,14 +65,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/e2cc3f0f-ce8d-4833-bed1-8367e410a3ac?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/237dc6c4-cd11-4d45-ba06-754498665c78?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:28:56.0319987+00:00\",\r\n \"endTime\": - \"2021-10-12T06:28:56.1258342+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:24:51.5960213+00:00\",\r\n \"endTime\": + \"2022-01-06T07:24:51.7366709+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"disknamex66bb1115\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus\",\r\n @@ -82,10 +82,10 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:28:56.0319987+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:24:51.6116307+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n }\r\n}\r\n - \ },\r\n \"name\": \"e2cc3f0f-ce8d-4833-bed1-8367e410a3ac\"\r\n}" + \ \"uniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n }\r\n}\r\n + \ },\r\n \"name\": \"237dc6c4-cd11-4d45-ba06-754498665c78\"\r\n}" headers: cache-control: - no-cache @@ -94,7 +94,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:28:57 GMT + - Thu, 06 Jan 2022 07:24:53 GMT expires: - '-1' pragma: @@ -111,7 +111,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49981,Microsoft.Compute/GetOperation30Min;399965 + - Microsoft.Compute/GetOperation3Min;49981,Microsoft.Compute/GetOperation30Min;399977 status: code: 200 message: OK @@ -125,10 +125,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"disknamex66bb1115\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n @@ -139,9 +139,9 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:28:56.0319987+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:24:51.6116307+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n }\r\n}" + \ \"uniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -150,7 +150,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:28:57 GMT + - Thu, 06 Jan 2022 07:24:53 GMT expires: - '-1' pragma: @@ -167,7 +167,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14977,Microsoft.Compute/LowCostGet30Min;119906 + - Microsoft.Compute/LowCostGet3Min;14989,Microsoft.Compute/LowCostGet30Min;119983 status: code: 200 message: OK @@ -186,20 +186,20 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-08-01 response: body: string: "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceUri\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n - \ \"sourceUniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n },\r\n + \ \"sourceUniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n },\r\n \ \"publicNetworkAccess\": \"Enabled\",\r\n \"provisioningState\": \"Updating\",\r\n \ \"isArmResource\": true\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/04940bb1-ee6f-4b0b-94b1-242307cf7aa0?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/d2bcb6e1-5fdc-4558-9d13-9eb0295c14da?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: @@ -207,11 +207,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:28:58 GMT + - Thu, 06 Jan 2022 07:24:54 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/04940bb1-ee6f-4b0b-94b1-242307cf7aa0?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/d2bcb6e1-5fdc-4558-9d13-9eb0295c14da?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -238,36 +238,36 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/04940bb1-ee6f-4b0b-94b1-242307cf7aa0?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/d2bcb6e1-5fdc-4558-9d13-9eb0295c14da?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:28:58.9382731+00:00\",\r\n \"endTime\": - \"2021-10-12T06:28:59.969499+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:24:54.3460404+00:00\",\r\n \"endTime\": + \"2022-01-06T07:24:55.2835246+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"snapshotx66bb1115\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115\",\r\n \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"eastus\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n - \ \"sourceUniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n },\r\n + \ \"sourceUniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n \ },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n - \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2021-10-12T06:28:58.9539014+00:00\",\r\n + \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2022-01-06T07:24:54.3616526+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"1a140676-f62d-44a1-a27c-de52ae646246\"\r\n - \ }\r\n}\r\n },\r\n \"name\": \"04940bb1-ee6f-4b0b-94b1-242307cf7aa0\"\r\n}" + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"47116e88-fa4e-48b9-ac80-36a33676b4cf\"\r\n + \ }\r\n}\r\n },\r\n \"name\": \"d2bcb6e1-5fdc-4558-9d13-9eb0295c14da\"\r\n}" headers: cache-control: - no-cache content-length: - - '1422' + - '1423' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:00 GMT + - Thu, 06 Jan 2022 07:24:56 GMT expires: - '-1' pragma: @@ -284,7 +284,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49983,Microsoft.Compute/GetOperation30Min;399964 + - Microsoft.Compute/GetOperation3Min;49980,Microsoft.Compute/GetOperation30Min;399976 status: code: 200 message: OK @@ -298,10 +298,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"snapshotx66bb1115\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115\",\r\n @@ -309,12 +309,12 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n - \ \"sourceUniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n },\r\n + \ \"sourceUniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n \ },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n - \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2021-10-12T06:28:58.9539014+00:00\",\r\n + \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2022-01-06T07:24:54.3616526+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"1a140676-f62d-44a1-a27c-de52ae646246\"\r\n + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"47116e88-fa4e-48b9-ac80-36a33676b4cf\"\r\n \ }\r\n}" headers: cache-control: @@ -324,7 +324,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:00 GMT + - Thu, 06 Jan 2022 07:24:56 GMT expires: - '-1' pragma: @@ -341,7 +341,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14976,Microsoft.Compute/LowCostGet30Min;119905 + - Microsoft.Compute/LowCostGet3Min;14988,Microsoft.Compute/LowCostGet30Min;119982 status: code: 200 message: OK @@ -362,7 +362,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/images/imagex66bb1115?api-version=2021-07-01 @@ -381,7 +381,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/93105f52-326a-41e2-a946-f32f12a6d356?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f05b28b-d78d-4257-bf4b-745bbe0ff7de?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -389,7 +389,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:02 GMT + - Thu, 06 Jan 2022 07:24:57 GMT expires: - '-1' pragma: @@ -418,15 +418,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/93105f52-326a-41e2-a946-f32f12a6d356?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f05b28b-d78d-4257-bf4b-745bbe0ff7de?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:29:02.0288875+00:00\",\r\n \"endTime\": - \"2021-10-12T06:29:07.0914116+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"93105f52-326a-41e2-a946-f32f12a6d356\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:24:56.9884615+00:00\",\r\n \"endTime\": + \"2022-01-06T07:25:22.1447407+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"8f05b28b-d78d-4257-bf4b-745bbe0ff7de\"\r\n}" headers: cache-control: - no-cache @@ -435,7 +435,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:31 GMT + - Thu, 06 Jan 2022 07:25:26 GMT expires: - '-1' pragma: @@ -452,7 +452,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14970,Microsoft.Compute/GetOperation30Min;29837 + - Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29995 status: code: 200 message: OK @@ -466,7 +466,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/images/imagex66bb1115?api-version=2021-07-01 @@ -490,7 +490,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:32 GMT + - Thu, 06 Jan 2022 07:25:26 GMT expires: - '-1' pragma: @@ -521,10 +521,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"snapshotx66bb1115\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115\",\r\n @@ -532,12 +532,12 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n - \ \"sourceUniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n },\r\n + \ \"sourceUniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n \ },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n - \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2021-10-12T06:28:58.9539014+00:00\",\r\n + \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2022-01-06T07:24:54.3616526+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"1a140676-f62d-44a1-a27c-de52ae646246\"\r\n + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"47116e88-fa4e-48b9-ac80-36a33676b4cf\"\r\n \ }\r\n}" headers: cache-control: @@ -547,7 +547,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:32 GMT + - Thu, 06 Jan 2022 07:25:26 GMT expires: - '-1' pragma: @@ -564,7 +564,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14962,Microsoft.Compute/LowCostGet30Min;119889 + - Microsoft.Compute/LowCostGet3Min;14982,Microsoft.Compute/LowCostGet30Min;119976 status: code: 200 message: OK @@ -578,7 +578,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/images/imagex66bb1115?api-version=2021-07-01 @@ -602,7 +602,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:32 GMT + - Thu, 06 Jan 2022 07:25:26 GMT expires: - '-1' pragma: @@ -637,7 +637,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/images/imagex66bb1115?api-version=2021-07-01 @@ -657,7 +657,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7d84c970-0e58-4c1c-ac41-cc2e4801b740?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/9412e9eb-a1c7-444d-b00f-3d215441f713?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -665,7 +665,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:29:33 GMT + - Thu, 06 Jan 2022 07:25:27 GMT expires: - '-1' pragma: @@ -698,15 +698,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7d84c970-0e58-4c1c-ac41-cc2e4801b740?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/9412e9eb-a1c7-444d-b00f-3d215441f713?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:29:33.2321996+00:00\",\r\n \"endTime\": - \"2021-10-12T06:29:38.5603556+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"7d84c970-0e58-4c1c-ac41-cc2e4801b740\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:25:27.7384734+00:00\",\r\n \"endTime\": + \"2022-01-06T07:25:32.8322034+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"9412e9eb-a1c7-444d-b00f-3d215441f713\"\r\n}" headers: cache-control: - no-cache @@ -715,7 +715,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:30:03 GMT + - Thu, 06 Jan 2022 07:25:58 GMT expires: - '-1' pragma: @@ -732,7 +732,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14961,Microsoft.Compute/GetOperation30Min;29824 + - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29994 status: code: 200 message: OK @@ -746,7 +746,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/images/imagex66bb1115?api-version=2021-07-01 @@ -770,7 +770,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:30:03 GMT + - Thu, 06 Jan 2022 07:25:58 GMT expires: - '-1' pragma: @@ -805,33 +805,34 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-08-01 response: body: string: "{\r\n \"location\": \"eastus\",\r\n \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \ \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n - \ \"sourceUniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n },\r\n + \ \"sourceUniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"provisioningState\": \"Updating\",\r\n \"isArmResource\": - true,\r\n \"faultDomain\": 0\r\n }\r\n}" + true,\r\n \"colocationConstraints\": {},\r\n \"faultDomain\": 0\r\n + \ }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8fcdf6c8-f447-4707-a81d-9f51a6b9a03a?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/67a1d416-99dd-42ca-ac3d-6c94d26e05fa?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - - '592' + - '626' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:30:03 GMT + - Thu, 06 Jan 2022 07:25:58 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8fcdf6c8-f447-4707-a81d-9f51a6b9a03a?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/67a1d416-99dd-42ca-ac3d-6c94d26e05fa?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -842,7 +843,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/CreateUpdateDisks3Min;998,Microsoft.Compute/CreateUpdateDisks30Min;7994 + - Microsoft.Compute/CreateUpdateDisks3Min;996,Microsoft.Compute/CreateUpdateDisks30Min;7994 x-ms-ratelimit-remaining-subscription-writes: - '1194' status: @@ -858,27 +859,27 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8fcdf6c8-f447-4707-a81d-9f51a6b9a03a?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/67a1d416-99dd-42ca-ac3d-6c94d26e05fa?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:30:04.4250525+00:00\",\r\n \"endTime\": - \"2021-10-12T06:30:04.5187804+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:25:58.2370236+00:00\",\r\n \"endTime\": + \"2022-01-06T07:25:58.3464387+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"snapshotx66bb1115\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115\",\r\n \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"eastus\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n - \ \"sourceUniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n },\r\n + \ \"sourceUniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n \ },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n - \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2021-10-12T06:28:58.9539014+00:00\",\r\n + \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2022-01-06T07:24:54.3616526+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"1a140676-f62d-44a1-a27c-de52ae646246\"\r\n - \ }\r\n}\r\n },\r\n \"name\": \"8fcdf6c8-f447-4707-a81d-9f51a6b9a03a\"\r\n}" + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"47116e88-fa4e-48b9-ac80-36a33676b4cf\"\r\n + \ }\r\n}\r\n },\r\n \"name\": \"67a1d416-99dd-42ca-ac3d-6c94d26e05fa\"\r\n}" headers: cache-control: - no-cache @@ -887,7 +888,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:30:06 GMT + - Thu, 06 Jan 2022 07:26:00 GMT expires: - '-1' pragma: @@ -904,7 +905,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49971,Microsoft.Compute/GetOperation30Min;399945 + - Microsoft.Compute/GetOperation3Min;49979,Microsoft.Compute/GetOperation30Min;399965 status: code: 200 message: OK @@ -918,10 +919,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"snapshotx66bb1115\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115\",\r\n @@ -929,12 +930,12 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/disknamex66bb1115\",\r\n - \ \"sourceUniqueId\": \"e639ece0-5979-41d7-90b5-408a51650b53\"\r\n },\r\n + \ \"sourceUniqueId\": \"b58ffd36-a950-4e3d-b2b4-922614df9286\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n \ },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n - \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2021-10-12T06:28:58.9539014+00:00\",\r\n + \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2022-01-06T07:24:54.3616526+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"1a140676-f62d-44a1-a27c-de52ae646246\"\r\n + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"47116e88-fa4e-48b9-ac80-36a33676b4cf\"\r\n \ }\r\n}" headers: cache-control: @@ -944,7 +945,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:30:06 GMT + - Thu, 06 Jan 2022 07:26:00 GMT expires: - '-1' pragma: @@ -961,7 +962,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14960,Microsoft.Compute/LowCostGet30Min;119881 + - Microsoft.Compute/LowCostGet3Min;14988,Microsoft.Compute/LowCostGet30Min;119974 status: code: 200 message: OK @@ -979,26 +980,26 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115/beginGetAccess?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115/beginGetAccess?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4ff19380-c6f4-468d-86f7-9872f942bc08?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/28bb7bfa-836a-4d77-bf57-8054dd00293a?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:30:06 GMT + - Thu, 06 Jan 2022 07:26:00 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4ff19380-c6f4-468d-86f7-9872f942bc08?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/28bb7bfa-836a-4d77-bf57-8054dd00293a?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -1025,25 +1026,25 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4ff19380-c6f4-468d-86f7-9872f942bc08?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/28bb7bfa-836a-4d77-bf57-8054dd00293a?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:30:06.8502514+00:00\",\r\n \"endTime\": - \"2021-10-12T06:30:06.9752399+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:26:00.4089223+00:00\",\r\n \"endTime\": + \"2022-01-06T07:26:00.5808114+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"accessSAS\": \"FakeUrl\"\r\n}\r\n - \ },\r\n \"name\": \"4ff19380-c6f4-468d-86f7-9872f942bc08\"\r\n}" + \ },\r\n \"name\": \"28bb7bfa-836a-4d77-bf57-8054dd00293a\"\r\n}" headers: cache-control: - no-cache content-length: - - '426' + - '428' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:30:36 GMT + - Thu, 06 Jan 2022 07:26:30 GMT expires: - '-1' pragma: @@ -1060,7 +1061,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49966,Microsoft.Compute/GetOperation30Min;399937 + - Microsoft.Compute/GetOperation3Min;49980,Microsoft.Compute/GetOperation30Min;399963 status: code: 200 message: OK @@ -1074,10 +1075,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4ff19380-c6f4-468d-86f7-9872f942bc08?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/28bb7bfa-836a-4d77-bf57-8054dd00293a?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 response: body: string: "{\r\n \"accessSAS\": \"FakeUrl\"\r\n}" @@ -1085,11 +1086,11 @@ interactions: cache-control: - no-cache content-length: - - '201' + - '203' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:30:36 GMT + - Thu, 06 Jan 2022 07:26:30 GMT expires: - '-1' pragma: @@ -1106,7 +1107,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49965,Microsoft.Compute/GetOperation30Min;399936 + - Microsoft.Compute/GetOperation3Min;49979,Microsoft.Compute/GetOperation30Min;399962 status: code: 200 message: OK @@ -1122,26 +1123,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115/endGetAccess?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115/endGetAccess?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/26063ba6-7933-4afb-807a-2bda5efffdf1?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/7ae36867-04ab-4894-b1a7-950dd9bbd9be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:30:37 GMT + - Thu, 06 Jan 2022 07:26:30 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/26063ba6-7933-4afb-807a-2bda5efffdf1?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/7ae36867-04ab-4894-b1a7-950dd9bbd9be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -1168,15 +1169,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/26063ba6-7933-4afb-807a-2bda5efffdf1?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/7ae36867-04ab-4894-b1a7-950dd9bbd9be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:30:37.3502887+00:00\",\r\n \"endTime\": - \"2021-10-12T06:30:37.4752915+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"26063ba6-7933-4afb-807a-2bda5efffdf1\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:26:30.6435045+00:00\",\r\n \"endTime\": + \"2022-01-06T07:26:30.7997558+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"7ae36867-04ab-4894-b1a7-950dd9bbd9be\"\r\n}" headers: cache-control: - no-cache @@ -1185,7 +1186,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:31:06 GMT + - Thu, 06 Jan 2022 07:26:59 GMT expires: - '-1' pragma: @@ -1202,7 +1203,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49960,Microsoft.Compute/GetOperation30Min;399928 + - Microsoft.Compute/GetOperation3Min;49980,Microsoft.Compute/GetOperation30Min;399960 status: code: 200 message: OK @@ -1216,10 +1217,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/26063ba6-7933-4afb-807a-2bda5efffdf1?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/7ae36867-04ab-4894-b1a7-950dd9bbd9be?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 response: body: string: '' @@ -1229,7 +1230,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 06:31:06 GMT + - Thu, 06 Jan 2022 07:27:00 GMT expires: - '-1' pragma: @@ -1242,7 +1243,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49959,Microsoft.Compute/GetOperation30Min;399927 + - Microsoft.Compute/GetOperation3Min;49979,Microsoft.Compute/GetOperation30Min;399959 status: code: 200 message: OK @@ -1258,7 +1259,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/images/imagex66bb1115?api-version=2021-07-01 @@ -1269,17 +1270,17 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0a1da581-0e16-4f69-bbd6-8cd85fab23ab?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f8b89b3-2789-49e1-8574-c6edc28878f7?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:31:07 GMT + - Thu, 06 Jan 2022 07:27:00 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0a1da581-0e16-4f69-bbd6-8cd85fab23ab?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f8b89b3-2789-49e1-8574-c6edc28878f7?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1292,7 +1293,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/DeleteImages3Min;119,Microsoft.Compute/DeleteImages30Min;599 x-ms-ratelimit-remaining-subscription-deletes: - - '14999' + - '14998' status: code: 202 message: Accepted @@ -1306,15 +1307,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0a1da581-0e16-4f69-bbd6-8cd85fab23ab?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f8b89b3-2789-49e1-8574-c6edc28878f7?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:31:07.9828872+00:00\",\r\n \"endTime\": - \"2021-10-12T06:31:13.0765927+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"0a1da581-0e16-4f69-bbd6-8cd85fab23ab\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:27:00.9260133+00:00\",\r\n \"endTime\": + \"2022-01-06T07:27:06.0197763+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"8f8b89b3-2789-49e1-8574-c6edc28878f7\"\r\n}" headers: cache-control: - no-cache @@ -1323,7 +1324,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:31:37 GMT + - Thu, 06 Jan 2022 07:27:30 GMT expires: - '-1' pragma: @@ -1340,7 +1341,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14980,Microsoft.Compute/GetOperation30Min;29822 + - Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29991 status: code: 200 message: OK @@ -1356,26 +1357,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotx66bb1115?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b950d54b-a218-4e8e-9291-3268655aae22?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8f375229-ad99-4438-83d3-1c5afdcd2e03?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:31:38 GMT + - Thu, 06 Jan 2022 07:27:31 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b950d54b-a218-4e8e-9291-3268655aae22?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8f375229-ad99-4438-83d3-1c5afdcd2e03?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -1386,9 +1387,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteDisks3Min;2987,Microsoft.Compute/DeleteDisks30Min;23981 + - Microsoft.Compute/DeleteDisks3Min;2999,Microsoft.Compute/DeleteDisks30Min;23997 x-ms-ratelimit-remaining-subscription-deletes: - - '14998' + - '14997' status: code: 202 message: Accepted @@ -1402,15 +1403,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/b950d54b-a218-4e8e-9291-3268655aae22?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8f375229-ad99-4438-83d3-1c5afdcd2e03?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:31:38.4133069+00:00\",\r\n \"endTime\": - \"2021-10-12T06:31:38.5695509+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"b950d54b-a218-4e8e-9291-3268655aae22\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:27:31.1908118+00:00\",\r\n \"endTime\": + \"2022-01-06T07:27:31.3783014+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"8f375229-ad99-4438-83d3-1c5afdcd2e03\"\r\n}" headers: cache-control: - no-cache @@ -1419,7 +1420,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:08 GMT + - Thu, 06 Jan 2022 07:28:00 GMT expires: - '-1' pragma: @@ -1436,7 +1437,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49969,Microsoft.Compute/GetOperation30Min;399923 + - Microsoft.Compute/GetOperation3Min;49988,Microsoft.Compute/GetOperation30Min;399955 status: code: 200 message: OK diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_galleries.test_compute_galleries.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_galleries.test_compute_galleries.yaml index 3589c3624cc9..b9a984547ebb 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_galleries.test_compute_galleries.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_galleries.test_compute_galleries.yaml @@ -14,10 +14,10 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"diskname10bb14a9\",\r\n \"location\": \"eastus\",\r\n @@ -26,7 +26,7 @@ interactions: \"Updating\",\r\n \"isArmResource\": true\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/37495199-65e0-481e-a1bf-797be790a449?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/20b7817c-eb57-411c-96c5-60ea71a67e3e?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: @@ -34,11 +34,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:11 GMT + - Thu, 06 Jan 2022 07:28:03 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/37495199-65e0-481e-a1bf-797be790a449?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/20b7817c-eb57-411c-96c5-60ea71a67e3e?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -65,14 +65,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/37495199-65e0-481e-a1bf-797be790a449?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/20b7817c-eb57-411c-96c5-60ea71a67e3e?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:32:12.1945591+00:00\",\r\n \"endTime\": - \"2021-10-12T06:32:12.2727019+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:28:03.6597568+00:00\",\r\n \"endTime\": + \"2022-01-06T07:28:03.7535179+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"diskname10bb14a9\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9\",\r\n \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus\",\r\n @@ -82,10 +82,10 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:32:12.1945591+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:28:03.6597568+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"82bd28cf-c906-4777-b1cf-26eb47bc8d9e\"\r\n }\r\n}\r\n - \ },\r\n \"name\": \"37495199-65e0-481e-a1bf-797be790a449\"\r\n}" + \ \"uniqueId\": \"997466ca-d9bf-466f-b6c4-109b19d3d630\"\r\n }\r\n}\r\n + \ },\r\n \"name\": \"20b7817c-eb57-411c-96c5-60ea71a67e3e\"\r\n}" headers: cache-control: - no-cache @@ -94,7 +94,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:13 GMT + - Thu, 06 Jan 2022 07:28:05 GMT expires: - '-1' pragma: @@ -111,7 +111,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49968,Microsoft.Compute/GetOperation30Min;399922 + - Microsoft.Compute/GetOperation3Min;49987,Microsoft.Compute/GetOperation30Min;399954 status: code: 200 message: OK @@ -125,10 +125,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"diskname10bb14a9\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9\",\r\n @@ -139,9 +139,9 @@ interactions: 500,\r\n \"diskMBpsReadWrite\": 60,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": - \"2021-10-12T06:32:12.1945591+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-01-06T07:28:03.6597568+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 214748364800,\r\n - \ \"uniqueId\": \"82bd28cf-c906-4777-b1cf-26eb47bc8d9e\"\r\n }\r\n}" + \ \"uniqueId\": \"997466ca-d9bf-466f-b6c4-109b19d3d630\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -150,7 +150,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:14 GMT + - Thu, 06 Jan 2022 07:28:05 GMT expires: - '-1' pragma: @@ -167,7 +167,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14976,Microsoft.Compute/LowCostGet30Min;119866 + - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119969 status: code: 200 message: OK @@ -186,20 +186,20 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9?api-version=2021-08-01 response: body: string: "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceUri\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9\",\r\n - \ \"sourceUniqueId\": \"82bd28cf-c906-4777-b1cf-26eb47bc8d9e\"\r\n },\r\n + \ \"sourceUniqueId\": \"997466ca-d9bf-466f-b6c4-109b19d3d630\"\r\n },\r\n \ \"publicNetworkAccess\": \"Enabled\",\r\n \"provisioningState\": \"Updating\",\r\n \ \"isArmResource\": true\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/ccd23289-98f4-4e2b-9a58-6adce0b9674f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8e5fafda-bb1d-4ad6-ac88-440db48918b1?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: @@ -207,11 +207,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:14 GMT + - Thu, 06 Jan 2022 07:28:06 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/ccd23289-98f4-4e2b-9a58-6adce0b9674f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8e5fafda-bb1d-4ad6-ac88-440db48918b1?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -238,27 +238,27 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/ccd23289-98f4-4e2b-9a58-6adce0b9674f?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/8e5fafda-bb1d-4ad6-ac88-440db48918b1?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:32:15.2258251+00:00\",\r\n \"endTime\": - \"2021-10-12T06:32:15.9914256+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:28:06.3004095+00:00\",\r\n \"endTime\": + \"2022-01-06T07:28:07.0191896+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"snapshotname10bb14a9\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9\",\r\n \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"eastus\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9\",\r\n - \ \"sourceUniqueId\": \"82bd28cf-c906-4777-b1cf-26eb47bc8d9e\"\r\n },\r\n + \ \"sourceUniqueId\": \"997466ca-d9bf-466f-b6c4-109b19d3d630\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n \ },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n - \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2021-10-12T06:32:15.2414272+00:00\",\r\n + \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2022-01-06T07:28:06.3004095+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"511e7134-808f-4a32-a250-40413ccda128\"\r\n - \ }\r\n}\r\n },\r\n \"name\": \"ccd23289-98f4-4e2b-9a58-6adce0b9674f\"\r\n}" + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"692ab3f8-b0b2-463c-ac8a-1a1516eeece7\"\r\n + \ }\r\n}\r\n },\r\n \"name\": \"8e5fafda-bb1d-4ad6-ac88-440db48918b1\"\r\n}" headers: cache-control: - no-cache @@ -267,7 +267,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:16 GMT + - Thu, 06 Jan 2022 07:28:08 GMT expires: - '-1' pragma: @@ -284,7 +284,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49967,Microsoft.Compute/GetOperation30Min;399921 + - Microsoft.Compute/GetOperation3Min;49986,Microsoft.Compute/GetOperation30Min;399953 status: code: 200 message: OK @@ -298,10 +298,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9?api-version=2021-08-01 response: body: string: "{\r\n \"name\": \"snapshotname10bb14a9\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9\",\r\n @@ -309,12 +309,12 @@ interactions: \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Copy\",\r\n \"sourceResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/diskname10bb14a9\",\r\n - \ \"sourceUniqueId\": \"82bd28cf-c906-4777-b1cf-26eb47bc8d9e\"\r\n },\r\n + \ \"sourceUniqueId\": \"997466ca-d9bf-466f-b6c4-109b19d3d630\"\r\n },\r\n \ \"diskSizeGB\": 200,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n \ },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n - \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2021-10-12T06:32:15.2414272+00:00\",\r\n + \ \"publicNetworkAccess\": \"Enabled\",\r\n \"timeCreated\": \"2022-01-06T07:28:06.3004095+00:00\",\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n - \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"511e7134-808f-4a32-a250-40413ccda128\"\r\n + \ \"diskSizeBytes\": 214748364800,\r\n \"uniqueId\": \"692ab3f8-b0b2-463c-ac8a-1a1516eeece7\"\r\n \ }\r\n}" headers: cache-control: @@ -324,7 +324,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:17 GMT + - Thu, 06 Jan 2022 07:28:08 GMT expires: - '-1' pragma: @@ -341,7 +341,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;14975,Microsoft.Compute/LowCostGet30Min;119865 + - Microsoft.Compute/LowCostGet3Min;14992,Microsoft.Compute/LowCostGet30Min;119968 status: code: 200 message: OK @@ -360,7 +360,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9?api-version=2021-07-01 @@ -370,19 +370,18 @@ interactions: \ \"type\": \"Microsoft.Compute/galleries\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"description\": \"This is the gallery description.\",\r\n \ \"identifier\": {\r\n \"uniqueName\": \"00000000-0000-0000-0000-000000000000-GALLERYNAME10BB14A9\"\r\n - \ },\r\n \"provisioningState\": \"Creating\",\r\n \"softDeletePolicy\": - {\r\n \"isSoftDeleteEnabled\": false\r\n }\r\n }\r\n}" + \ },\r\n \"provisioningState\": \"Creating\"\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/bba0ddef-20cc-4e14-a598-7a43e4f61b77?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/23cf986f-7d7f-480b-b74e-d115cea71538?api-version=2021-07-01 cache-control: - no-cache content-length: - - '620' + - '549' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:18 GMT + - Thu, 06 Jan 2022 07:28:09 GMT expires: - '-1' pragma: @@ -411,24 +410,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/bba0ddef-20cc-4e14-a598-7a43e4f61b77?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/23cf986f-7d7f-480b-b74e-d115cea71538?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:32:18.4276358+00:00\",\r\n \"endTime\": - \"2021-10-12T06:32:19.0213799+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"bba0ddef-20cc-4e14-a598-7a43e4f61b77\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:28:08.978813+00:00\",\r\n \"endTime\": + \"2022-01-06T07:28:09.713211+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"23cf986f-7d7f-480b-b74e-d115cea71538\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '182' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:48 GMT + - Thu, 06 Jan 2022 07:28:38 GMT expires: - '-1' pragma: @@ -459,7 +458,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9?api-version=2021-07-01 @@ -469,17 +468,16 @@ interactions: \ \"type\": \"Microsoft.Compute/galleries\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"description\": \"This is the gallery description.\",\r\n \ \"identifier\": {\r\n \"uniqueName\": \"00000000-0000-0000-0000-000000000000-GALLERYNAME10BB14A9\"\r\n - \ },\r\n \"provisioningState\": \"Succeeded\",\r\n \"softDeletePolicy\": - {\r\n \"isSoftDeleteEnabled\": false\r\n }\r\n }\r\n}" + \ },\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}" headers: cache-control: - no-cache content-length: - - '621' + - '550' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:48 GMT + - Thu, 06 Jan 2022 07:28:38 GMT expires: - '-1' pragma: @@ -516,7 +514,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/applications/applicationname10bb14a9?api-version=2021-07-01 @@ -535,7 +533,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:32:48 GMT + - Thu, 06 Jan 2022 07:28:39 GMT expires: - '-1' pragma: @@ -564,7 +562,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/applications/applicationname10bb14a9?api-version=2021-07-01 @@ -583,7 +581,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:33:19 GMT + - Thu, 06 Jan 2022 07:29:09 GMT expires: - '-1' pragma: @@ -620,7 +618,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9?api-version=2021-07-01 @@ -635,7 +633,7 @@ interactions: \"Creating\"\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ef6ebab7-3f9b-489e-8508-0ff9dda7687f?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/a82b8bb2-63ca-4948-8ea9-e50832856fbd?api-version=2021-07-01 cache-control: - no-cache content-length: @@ -643,7 +641,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:33:20 GMT + - Thu, 06 Jan 2022 07:29:10 GMT expires: - '-1' pragma: @@ -672,15 +670,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ef6ebab7-3f9b-489e-8508-0ff9dda7687f?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/a82b8bb2-63ca-4948-8ea9-e50832856fbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:20.6135361+00:00\",\r\n \"endTime\": - \"2021-10-12T06:33:20.7697645+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"ef6ebab7-3f9b-489e-8508-0ff9dda7687f\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:11.0100485+00:00\",\r\n \"endTime\": + \"2022-01-06T07:29:11.1194078+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"a82b8bb2-63ca-4948-8ea9-e50832856fbd\"\r\n}" headers: cache-control: - no-cache @@ -689,7 +687,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:33:50 GMT + - Thu, 06 Jan 2022 07:29:41 GMT expires: - '-1' pragma: @@ -720,7 +718,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9?api-version=2021-07-01 @@ -741,7 +739,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:33:50 GMT + - Thu, 06 Jan 2022 07:29:41 GMT expires: - '-1' pragma: @@ -779,7 +777,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9/versions/1.0.0?api-version=2021-07-01 @@ -791,7 +789,7 @@ interactions: [\r\n {\r\n \"name\": \"East US\",\r\n \"regionalReplicaCount\": 2,\r\n \"storageAccountType\": \"Standard_ZRS\"\r\n }\r\n \ ],\r\n \"replicaCount\": 1,\r\n \"excludeFromLatest\": false,\r\n - \ \"publishedDate\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"storageAccountType\": + \ \"publishedDate\": \"2022-01-06T07:29:41.978737+00:00\",\r\n \"storageAccountType\": \"Standard_LRS\"\r\n },\r\n \"storageProfile\": {\r\n \"osDiskImage\": {\r\n \"hostCaching\": \"ReadOnly\",\r\n \"source\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9\"\r\n @@ -799,15 +797,15 @@ interactions: \ }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 cache-control: - no-cache content-length: - - '1159' + - '1158' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:33:51 GMT + - Thu, 06 Jan 2022 07:29:42 GMT expires: - '-1' pragma: @@ -836,14 +834,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -852,7 +850,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:34:52 GMT + - Thu, 06 Jan 2022 07:30:42 GMT expires: - '-1' pragma: @@ -883,14 +881,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -899,7 +897,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:35:52 GMT + - Thu, 06 Jan 2022 07:31:41 GMT expires: - '-1' pragma: @@ -930,14 +928,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -946,7 +944,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:36:53 GMT + - Thu, 06 Jan 2022 07:32:42 GMT expires: - '-1' pragma: @@ -977,14 +975,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -993,7 +991,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:37:53 GMT + - Thu, 06 Jan 2022 07:33:42 GMT expires: - '-1' pragma: @@ -1024,14 +1022,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1040,7 +1038,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:38:53 GMT + - Thu, 06 Jan 2022 07:34:42 GMT expires: - '-1' pragma: @@ -1071,14 +1069,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1087,7 +1085,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:39:54 GMT + - Thu, 06 Jan 2022 07:35:42 GMT expires: - '-1' pragma: @@ -1118,14 +1116,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1134,7 +1132,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:40:54 GMT + - Thu, 06 Jan 2022 07:36:43 GMT expires: - '-1' pragma: @@ -1165,14 +1163,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1181,7 +1179,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:41:54 GMT + - Thu, 06 Jan 2022 07:37:42 GMT expires: - '-1' pragma: @@ -1212,14 +1210,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1228,7 +1226,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:42:54 GMT + - Thu, 06 Jan 2022 07:38:43 GMT expires: - '-1' pragma: @@ -1259,14 +1257,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1275,7 +1273,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:43:55 GMT + - Thu, 06 Jan 2022 07:39:43 GMT expires: - '-1' pragma: @@ -1306,14 +1304,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1322,7 +1320,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:44:55 GMT + - Thu, 06 Jan 2022 07:40:42 GMT expires: - '-1' pragma: @@ -1339,7 +1337,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperationStatus3Min;1194,Microsoft.Compute/GetOperationStatus30Min;4175 + - Microsoft.Compute/GetOperationStatus3Min;1195,Microsoft.Compute/GetOperationStatus30Min;4175 status: code: 200 message: OK @@ -1353,15 +1351,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/ceff4640-315e-4b03-87b1-e8934847cd0e?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"endTime\": - \"2021-10-12T06:45:08.0860685+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"ceff4640-315e-4b03-87b1-e8934847cd0e\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:29:41.9631521+00:00\",\r\n \"endTime\": + \"2022-01-06T07:40:58.0865779+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"3bdb823d-8d4d-4a9e-80cf-adca5a13bcbd\"\r\n}" headers: cache-control: - no-cache @@ -1370,7 +1368,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:45:56 GMT + - Thu, 06 Jan 2022 07:41:43 GMT expires: - '-1' pragma: @@ -1387,7 +1385,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperationStatus3Min;1194,Microsoft.Compute/GetOperationStatus30Min;4173 + - Microsoft.Compute/GetOperationStatus3Min;1195,Microsoft.Compute/GetOperationStatus30Min;4173 status: code: 200 message: OK @@ -1401,7 +1399,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9/versions/1.0.0?api-version=2021-07-01 @@ -1413,7 +1411,7 @@ interactions: [\r\n {\r\n \"name\": \"East US\",\r\n \"regionalReplicaCount\": 2,\r\n \"storageAccountType\": \"Standard_ZRS\"\r\n }\r\n \ ],\r\n \"replicaCount\": 1,\r\n \"excludeFromLatest\": false,\r\n - \ \"publishedDate\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"storageAccountType\": + \ \"publishedDate\": \"2022-01-06T07:29:41.978737+00:00\",\r\n \"storageAccountType\": \"Standard_LRS\"\r\n },\r\n \"storageProfile\": {\r\n \"osDiskImage\": {\r\n \"sizeInGB\": 200,\r\n \"hostCaching\": \"ReadOnly\",\r\n \ \"source\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9\"\r\n @@ -1423,11 +1421,11 @@ interactions: cache-control: - no-cache content-length: - - '1186' + - '1185' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:45:56 GMT + - Thu, 06 Jan 2022 07:41:43 GMT expires: - '-1' pragma: @@ -1458,7 +1456,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9/versions/1.0.0?api-version=2021-07-01 @@ -1470,7 +1468,7 @@ interactions: [\r\n {\r\n \"name\": \"East US\",\r\n \"regionalReplicaCount\": 2,\r\n \"storageAccountType\": \"Standard_ZRS\"\r\n }\r\n \ ],\r\n \"replicaCount\": 1,\r\n \"excludeFromLatest\": false,\r\n - \ \"publishedDate\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"storageAccountType\": + \ \"publishedDate\": \"2022-01-06T07:29:41.978737+00:00\",\r\n \"storageAccountType\": \"Standard_LRS\"\r\n },\r\n \"storageProfile\": {\r\n \"osDiskImage\": {\r\n \"sizeInGB\": 200,\r\n \"hostCaching\": \"ReadOnly\",\r\n \ \"source\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9\"\r\n @@ -1480,11 +1478,11 @@ interactions: cache-control: - no-cache content-length: - - '1186' + - '1185' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:45:56 GMT + - Thu, 06 Jan 2022 07:41:43 GMT expires: - '-1' pragma: @@ -1515,7 +1513,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9?api-version=2021-07-01 @@ -1536,7 +1534,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:45:56 GMT + - Thu, 06 Jan 2022 07:41:43 GMT expires: - '-1' pragma: @@ -1553,7 +1551,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetGalleryImage3Min;594,Microsoft.Compute/GetGalleryImage30Min;2989 + - Microsoft.Compute/GetGalleryImage3Min;595,Microsoft.Compute/GetGalleryImage30Min;2989 status: code: 200 message: OK @@ -1567,7 +1565,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/applications/applicationname10bb14a9?api-version=2021-07-01 @@ -1586,7 +1584,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:45:56 GMT + - Thu, 06 Jan 2022 07:41:43 GMT expires: - '-1' pragma: @@ -1603,7 +1601,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetGalleryApplication3Min;299,Microsoft.Compute/GetGalleryApplication30Min;1995 + - Microsoft.Compute/GetGalleryApplication3Min;298,Microsoft.Compute/GetGalleryApplication30Min;1993 status: code: 200 message: OK @@ -1617,7 +1615,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9?api-version=2021-07-01 @@ -1627,17 +1625,16 @@ interactions: \ \"type\": \"Microsoft.Compute/galleries\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"description\": \"This is the gallery description.\",\r\n \ \"identifier\": {\r\n \"uniqueName\": \"00000000-0000-0000-0000-000000000000-GALLERYNAME10BB14A9\"\r\n - \ },\r\n \"provisioningState\": \"Succeeded\",\r\n \"softDeletePolicy\": - {\r\n \"isSoftDeleteEnabled\": false\r\n }\r\n }\r\n}" + \ },\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}" headers: cache-control: - no-cache content-length: - - '621' + - '550' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:45:56 GMT + - Thu, 06 Jan 2022 07:41:43 GMT expires: - '-1' pragma: @@ -1674,7 +1671,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9/versions/1.0.0?api-version=2021-07-01 @@ -1686,7 +1683,7 @@ interactions: [\r\n {\r\n \"name\": \"East US\",\r\n \"regionalReplicaCount\": 2,\r\n \"storageAccountType\": \"Standard_ZRS\"\r\n }\r\n \ ],\r\n \"replicaCount\": 1,\r\n \"excludeFromLatest\": false,\r\n - \ \"publishedDate\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"storageAccountType\": + \ \"publishedDate\": \"2022-01-06T07:29:41.978737+00:00\",\r\n \"storageAccountType\": \"Standard_LRS\"\r\n },\r\n \"storageProfile\": {\r\n \"osDiskImage\": {\r\n \"sizeInGB\": 200,\r\n \"hostCaching\": \"ReadOnly\",\r\n \ \"source\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9\"\r\n @@ -1694,15 +1691,15 @@ interactions: \ }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6abf3942-8b28-4118-86cb-7aa08b8e5c60?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6d72bd4c-cb4f-4dd7-abc3-0527a894a7f5?api-version=2021-07-01 cache-control: - no-cache content-length: - - '1185' + - '1184' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:45:57 GMT + - Thu, 06 Jan 2022 07:41:43 GMT expires: - '-1' pragma: @@ -1735,14 +1732,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6abf3942-8b28-4118-86cb-7aa08b8e5c60?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6d72bd4c-cb4f-4dd7-abc3-0527a894a7f5?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:45:57.3362933+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"6abf3942-8b28-4118-86cb-7aa08b8e5c60\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:41:43.9301295+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"6d72bd4c-cb4f-4dd7-abc3-0527a894a7f5\"\r\n}" headers: cache-control: - no-cache @@ -1751,7 +1748,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:46:57 GMT + - Thu, 06 Jan 2022 07:42:43 GMT expires: - '-1' pragma: @@ -1768,7 +1765,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperationStatus3Min;1194,Microsoft.Compute/GetOperationStatus30Min;4171 + - Microsoft.Compute/GetOperationStatus3Min;1195,Microsoft.Compute/GetOperationStatus30Min;4171 status: code: 200 message: OK @@ -1782,14 +1779,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6abf3942-8b28-4118-86cb-7aa08b8e5c60?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6d72bd4c-cb4f-4dd7-abc3-0527a894a7f5?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:45:57.3362933+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"6abf3942-8b28-4118-86cb-7aa08b8e5c60\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:41:43.9301295+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"6d72bd4c-cb4f-4dd7-abc3-0527a894a7f5\"\r\n}" headers: cache-control: - no-cache @@ -1798,7 +1795,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:47:58 GMT + - Thu, 06 Jan 2022 07:43:43 GMT expires: - '-1' pragma: @@ -1815,7 +1812,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperationStatus3Min;1195,Microsoft.Compute/GetOperationStatus30Min;4170 + - Microsoft.Compute/GetOperationStatus3Min;1196,Microsoft.Compute/GetOperationStatus30Min;4170 status: code: 200 message: OK @@ -1829,15 +1826,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6abf3942-8b28-4118-86cb-7aa08b8e5c60?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/6d72bd4c-cb4f-4dd7-abc3-0527a894a7f5?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:45:57.3362933+00:00\",\r\n \"endTime\": - \"2021-10-12T06:48:27.5088794+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"6abf3942-8b28-4118-86cb-7aa08b8e5c60\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:41:43.9301295+00:00\",\r\n \"endTime\": + \"2022-01-06T07:44:14.1330572+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"6d72bd4c-cb4f-4dd7-abc3-0527a894a7f5\"\r\n}" headers: cache-control: - no-cache @@ -1846,7 +1843,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:48:58 GMT + - Thu, 06 Jan 2022 07:44:43 GMT expires: - '-1' pragma: @@ -1863,7 +1860,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperationStatus3Min;1196,Microsoft.Compute/GetOperationStatus30Min;4169 + - Microsoft.Compute/GetOperationStatus3Min;1197,Microsoft.Compute/GetOperationStatus30Min;4169 status: code: 200 message: OK @@ -1877,7 +1874,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9/versions/1.0.0?api-version=2021-07-01 @@ -1889,7 +1886,7 @@ interactions: [\r\n {\r\n \"name\": \"East US\",\r\n \"regionalReplicaCount\": 2,\r\n \"storageAccountType\": \"Standard_ZRS\"\r\n }\r\n \ ],\r\n \"replicaCount\": 1,\r\n \"excludeFromLatest\": false,\r\n - \ \"publishedDate\": \"2021-10-12T06:33:52.0352727+00:00\",\r\n \"storageAccountType\": + \ \"publishedDate\": \"2022-01-06T07:29:41.978737+00:00\",\r\n \"storageAccountType\": \"Standard_LRS\"\r\n },\r\n \"storageProfile\": {\r\n \"osDiskImage\": {\r\n \"sizeInGB\": 200,\r\n \"hostCaching\": \"ReadOnly\",\r\n \ \"source\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9\"\r\n @@ -1899,11 +1896,11 @@ interactions: cache-control: - no-cache content-length: - - '1186' + - '1185' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:48:58 GMT + - Thu, 06 Jan 2022 07:44:43 GMT expires: - '-1' pragma: @@ -1920,7 +1917,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetGalleryImageVersion3Min;1997,Microsoft.Compute/GetGalleryImageVersion30Min;9992 + - Microsoft.Compute/GetGalleryImageVersion3Min;1999,Microsoft.Compute/GetGalleryImageVersion30Min;9992 status: code: 200 message: OK @@ -1939,7 +1936,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9?api-version=2021-07-01 @@ -1954,7 +1951,7 @@ interactions: \"Updating\"\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/99db2786-6918-4bd7-b3c8-7e4168725b4c?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/93a16bad-bf8e-40ab-b7ce-3d6261864f60?api-version=2021-07-01 cache-control: - no-cache content-length: @@ -1962,7 +1959,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:48:58 GMT + - Thu, 06 Jan 2022 07:44:43 GMT expires: - '-1' pragma: @@ -1995,15 +1992,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/99db2786-6918-4bd7-b3c8-7e4168725b4c?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/93a16bad-bf8e-40ab-b7ce-3d6261864f60?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:48:58.8215537+00:00\",\r\n \"endTime\": - \"2021-10-12T06:48:58.8527786+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"99db2786-6918-4bd7-b3c8-7e4168725b4c\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:44:44.4924025+00:00\",\r\n \"endTime\": + \"2022-01-06T07:44:44.5392752+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"93a16bad-bf8e-40ab-b7ce-3d6261864f60\"\r\n}" headers: cache-control: - no-cache @@ -2012,7 +2009,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:49:28 GMT + - Thu, 06 Jan 2022 07:45:14 GMT expires: - '-1' pragma: @@ -2043,7 +2040,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9?api-version=2021-07-01 @@ -2064,7 +2061,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:49:28 GMT + - Thu, 06 Jan 2022 07:45:14 GMT expires: - '-1' pragma: @@ -2081,7 +2078,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetGalleryImage3Min;598,Microsoft.Compute/GetGalleryImage30Min;2987 + - Microsoft.Compute/GetGalleryImage3Min;597,Microsoft.Compute/GetGalleryImage30Min;2986 status: code: 200 message: OK @@ -2101,7 +2098,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/applications/applicationname10bb14a9?api-version=2021-07-01 @@ -2121,7 +2118,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:49:28 GMT + - Thu, 06 Jan 2022 07:45:14 GMT expires: - '-1' pragma: @@ -2158,7 +2155,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9?api-version=2021-07-01 @@ -2168,19 +2165,18 @@ interactions: \ \"type\": \"Microsoft.Compute/galleries\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"description\": \"This is the gallery description.\",\r\n \ \"identifier\": {\r\n \"uniqueName\": \"00000000-0000-0000-0000-000000000000-GALLERYNAME10BB14A9\"\r\n - \ },\r\n \"provisioningState\": \"Succeeded\",\r\n \"softDeletePolicy\": - {\r\n \"isSoftDeleteEnabled\": false\r\n }\r\n }\r\n}" + \ },\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/e52296d4-b0e9-40fa-8845-c7093481d5c7?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/8c63a1c0-e182-4ec3-b4b1-d9e85bfbfe8a?api-version=2021-07-01 cache-control: - no-cache content-length: - - '621' + - '550' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:49:28 GMT + - Thu, 06 Jan 2022 07:45:14 GMT expires: - '-1' pragma: @@ -2213,15 +2209,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/e52296d4-b0e9-40fa-8845-c7093481d5c7?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/8c63a1c0-e182-4ec3-b4b1-d9e85bfbfe8a?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:49:29.4778095+00:00\",\r\n \"endTime\": - \"2021-10-12T06:49:29.5246889+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"e52296d4-b0e9-40fa-8845-c7093481d5c7\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:45:15.1642793+00:00\",\r\n \"endTime\": + \"2022-01-06T07:45:15.2111263+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"8c63a1c0-e182-4ec3-b4b1-d9e85bfbfe8a\"\r\n}" headers: cache-control: - no-cache @@ -2230,7 +2226,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:49:59 GMT + - Thu, 06 Jan 2022 07:45:44 GMT expires: - '-1' pragma: @@ -2261,7 +2257,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9?api-version=2021-07-01 @@ -2271,17 +2267,16 @@ interactions: \ \"type\": \"Microsoft.Compute/galleries\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"description\": \"This is the gallery description.\",\r\n \ \"identifier\": {\r\n \"uniqueName\": \"00000000-0000-0000-0000-000000000000-GALLERYNAME10BB14A9\"\r\n - \ },\r\n \"provisioningState\": \"Succeeded\",\r\n \"softDeletePolicy\": - {\r\n \"isSoftDeleteEnabled\": false\r\n }\r\n }\r\n}" + \ },\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}" headers: cache-control: - no-cache content-length: - - '621' + - '550' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:49:59 GMT + - Thu, 06 Jan 2022 07:45:44 GMT expires: - '-1' pragma: @@ -2314,7 +2309,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9/versions/1.0.0?api-version=2021-07-01 @@ -2323,17 +2318,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/2ceb39ec-7d8f-42d8-a2b8-9e2e415127e2?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/7f93843d-7c10-4832-9fb5-6beaf95c29d8?api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:50:00 GMT + - Thu, 06 Jan 2022 07:45:44 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/2ceb39ec-7d8f-42d8-a2b8-9e2e415127e2?monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/7f93843d-7c10-4832-9fb5-6beaf95c29d8?monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2360,14 +2355,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/2ceb39ec-7d8f-42d8-a2b8-9e2e415127e2?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/7f93843d-7c10-4832-9fb5-6beaf95c29d8?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:50:00.3684688+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"2ceb39ec-7d8f-42d8-a2b8-9e2e415127e2\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:45:45.3829963+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"7f93843d-7c10-4832-9fb5-6beaf95c29d8\"\r\n}" headers: cache-control: - no-cache @@ -2376,7 +2371,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:51:00 GMT + - Thu, 06 Jan 2022 07:46:45 GMT expires: - '-1' pragma: @@ -2407,24 +2402,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/2ceb39ec-7d8f-42d8-a2b8-9e2e415127e2?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/7f93843d-7c10-4832-9fb5-6beaf95c29d8?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:50:00.3684688+00:00\",\r\n \"endTime\": - \"2021-10-12T06:51:30.5404286+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"2ceb39ec-7d8f-42d8-a2b8-9e2e415127e2\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:45:45.3829963+00:00\",\r\n \"endTime\": + \"2022-01-06T07:47:15.539171+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"7f93843d-7c10-4832-9fb5-6beaf95c29d8\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '183' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:52:00 GMT + - Thu, 06 Jan 2022 07:47:45 GMT expires: - '-1' pragma: @@ -2441,7 +2436,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperationStatus3Min;1196,Microsoft.Compute/GetOperationStatus30Min;4164 + - Microsoft.Compute/GetOperationStatus3Min;1195,Microsoft.Compute/GetOperationStatus30Min;4164 status: code: 200 message: OK @@ -2457,7 +2452,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/applications/applicationname10bb14a9?api-version=2021-07-01 @@ -2470,7 +2465,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 06:52:00 GMT + - Thu, 06 Jan 2022 07:47:46 GMT expires: - '-1' pragma: @@ -2501,26 +2496,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9/endGetAccess?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9/endGetAccess?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4f74889f-14a4-43ae-8139-25cdd02fc9bd?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/d4dad3c3-99f3-4b04-9e41-11b7eb57cafc?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:52:00 GMT + - Thu, 06 Jan 2022 07:47:46 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4f74889f-14a4-43ae-8139-25cdd02fc9bd?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/d4dad3c3-99f3-4b04-9e41-11b7eb57cafc?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -2547,15 +2542,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4f74889f-14a4-43ae-8139-25cdd02fc9bd?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/d4dad3c3-99f3-4b04-9e41-11b7eb57cafc?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:52:01.5005537+00:00\",\r\n \"endTime\": - \"2021-10-12T06:52:01.6411621+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"4f74889f-14a4-43ae-8139-25cdd02fc9bd\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:47:46.2500281+00:00\",\r\n \"endTime\": + \"2022-01-06T07:47:46.3437565+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"d4dad3c3-99f3-4b04-9e41-11b7eb57cafc\"\r\n}" headers: cache-control: - no-cache @@ -2564,7 +2559,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:52:31 GMT + - Thu, 06 Jan 2022 07:48:15 GMT expires: - '-1' pragma: @@ -2581,7 +2576,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49996,Microsoft.Compute/GetOperation30Min;399871 + - Microsoft.Compute/GetOperation3Min;49996,Microsoft.Compute/GetOperation30Min;399920 status: code: 200 message: OK @@ -2595,10 +2590,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4f74889f-14a4-43ae-8139-25cdd02fc9bd?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/d4dad3c3-99f3-4b04-9e41-11b7eb57cafc?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 response: body: string: '' @@ -2608,7 +2603,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 06:52:31 GMT + - Thu, 06 Jan 2022 07:48:16 GMT expires: - '-1' pragma: @@ -2621,7 +2616,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49995,Microsoft.Compute/GetOperation30Min;399870 + - Microsoft.Compute/GetOperation3Min;49995,Microsoft.Compute/GetOperation30Min;399919 status: code: 200 message: OK @@ -2637,26 +2632,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/snapshots/snapshotname10bb14a9?api-version=2021-08-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4ba0ce19-ddae-4e40-bd09-9e1308d71373?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/15c79f7a-badc-4fcd-8324-783c5bb9a128?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:52:31 GMT + - Thu, 06 Jan 2022 07:48:16 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4ba0ce19-ddae-4e40-bd09-9e1308d71373?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/15c79f7a-badc-4fcd-8324-783c5bb9a128?p=36ee1309-094c-4cec-b989-37cf5e794c1b&monitor=true&api-version=2021-08-01 pragma: - no-cache server: @@ -2667,7 +2662,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteDisks3Min;2996,Microsoft.Compute/DeleteDisks30Min;23964 + - Microsoft.Compute/DeleteDisks3Min;2996,Microsoft.Compute/DeleteDisks30Min;23989 x-ms-ratelimit-remaining-subscription-deletes: - '14994' status: @@ -2683,15 +2678,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/4ba0ce19-ddae-4e40-bd09-9e1308d71373?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/DiskOperations/15c79f7a-badc-4fcd-8324-783c5bb9a128?p=36ee1309-094c-4cec-b989-37cf5e794c1b&api-version=2021-08-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:52:32.1100623+00:00\",\r\n \"endTime\": - \"2021-10-12T06:52:32.3288017+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"4ba0ce19-ddae-4e40-bd09-9e1308d71373\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:48:16.5009892+00:00\",\r\n \"endTime\": + \"2022-01-06T07:48:16.6884752+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"15c79f7a-badc-4fcd-8324-783c5bb9a128\"\r\n}" headers: cache-control: - no-cache @@ -2700,7 +2695,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:53:01 GMT + - Thu, 06 Jan 2022 07:48:45 GMT expires: - '-1' pragma: @@ -2717,7 +2712,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;49993,Microsoft.Compute/GetOperation30Min;399868 + - Microsoft.Compute/GetOperation3Min;49993,Microsoft.Compute/GetOperation30Min;399917 status: code: 200 message: OK @@ -2733,7 +2728,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9/images/imagex10bb14a9?api-version=2021-07-01 @@ -2742,17 +2737,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/01a4a2f4-7ad0-401c-a0cb-de1fbfddd984?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/917389af-92a7-46fe-aa48-203b1e8bd660?api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:53:02 GMT + - Thu, 06 Jan 2022 07:48:46 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/01a4a2f4-7ad0-401c-a0cb-de1fbfddd984?monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/917389af-92a7-46fe-aa48-203b1e8bd660?monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2779,24 +2774,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/01a4a2f4-7ad0-401c-a0cb-de1fbfddd984?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/917389af-92a7-46fe-aa48-203b1e8bd660?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:53:03.0873238+00:00\",\r\n \"endTime\": - \"2021-10-12T06:53:03.3841996+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"01a4a2f4-7ad0-401c-a0cb-de1fbfddd984\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:48:46.7578658+00:00\",\r\n \"endTime\": + \"2022-01-06T07:48:46.992241+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"917389af-92a7-46fe-aa48-203b1e8bd660\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '183' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:53:33 GMT + - Thu, 06 Jan 2022 07:49:16 GMT expires: - '-1' pragma: @@ -2829,7 +2824,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/galleries/galleryname10bb14a9?api-version=2021-07-01 @@ -2838,17 +2833,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/c9659b6e-1b23-4805-8291-a85b90a3c976?api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/96ccb7bf-0209-48a2-a74f-408cde988391?api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:53:34 GMT + - Thu, 06 Jan 2022 07:49:17 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/c9659b6e-1b23-4805-8291-a85b90a3c976?monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/96ccb7bf-0209-48a2-a74f-408cde988391?monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2875,15 +2870,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/c9659b6e-1b23-4805-8291-a85b90a3c976?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/capsOperations/96ccb7bf-0209-48a2-a74f-408cde988391?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:53:33.9779607+00:00\",\r\n \"endTime\": - \"2021-10-12T06:53:34.0873131+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"c9659b6e-1b23-4805-8291-a85b90a3c976\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:49:16.9922472+00:00\",\r\n \"endTime\": + \"2022-01-06T07:49:17.7266014+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"96ccb7bf-0209-48a2-a74f-408cde988391\"\r\n}" headers: cache-control: - no-cache @@ -2892,7 +2887,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:03 GMT + - Thu, 06 Jan 2022 07:49:47 GMT expires: - '-1' pragma: diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm.yaml index d30c346c6d51..2dfd7814ba71 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm.yaml @@ -14,17 +14,17 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff\",\r\n - \ \"etag\": \"W/\\\"0dda6935-e3cf-4611-9930-009deab7881a\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"99a9da16-e35c-484a-9732-07a80bf91130\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"21f5ec39-5eed-4b7e-89d7-d24261f3ea14\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"eed9e124-ce6a-4a20-822d-e7f88a272c76\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -32,7 +32,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/c73808f0-da06-47b5-9e0b-ea41a7334c12?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/10b59524-5c33-462e-a025-227ffa2bd261?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -40,7 +40,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:11 GMT + - Thu, 06 Jan 2022 07:49:53 GMT expires: - '-1' pragma: @@ -53,7 +53,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - a7c687ad-171f-4563-a02b-031c0c299968 + - 63444e7d-4b2c-443b-ac81-d69bdd976e97 x-ms-ratelimit-remaining-subscription-writes: - '1193' status: @@ -69,10 +69,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/c73808f0-da06-47b5-9e0b-ea41a7334c12?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/10b59524-5c33-462e-a025-227ffa2bd261?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -84,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:14 GMT + - Thu, 06 Jan 2022 07:49:56 GMT expires: - '-1' pragma: @@ -101,7 +101,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - bd858fab-9f64-45f4-9e9f-12976b0060ea + - 76111863-3cb3-40ae-b39d-79becd2fcd5d status: code: 200 message: OK @@ -115,17 +115,17 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff\",\r\n - \ \"etag\": \"W/\\\"a8a3cd2b-1a48-4263-911b-687216d655f1\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"e733c23b-dfb7-4047-a393-24f58c3e70ff\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"21f5ec39-5eed-4b7e-89d7-d24261f3ea14\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"eed9e124-ce6a-4a20-822d-e7f88a272c76\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -137,9 +137,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:14 GMT + - Thu, 06 Jan 2022 07:49:56 GMT etag: - - W/"a8a3cd2b-1a48-4263-911b-687216d655f1" + - W/"e733c23b-dfb7-4047-a393-24f58c3e70ff" expires: - '-1' pragma: @@ -156,7 +156,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - e4fc58ca-6dd4-4ff4-b1eb-213566fc951a + - eaacdad2-3d6e-4004-a3b9-bd816b59dfde status: code: 200 message: OK @@ -174,21 +174,21 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff/subnets/subnetx15cf0eff?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff/subnets/subnetx15cf0eff?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetx15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff/subnets/subnetx15cf0eff\",\r\n - \ \"etag\": \"W/\\\"1ebafd42-d663-4ea9-a53d-56314955be2e\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"50e5d5e2-2e0b-40e5-a091-67ff9a6192f8\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/10ffea68-e980-4914-91e7-9754309298e0?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/0529f563-ee0e-46d4-b888-d5eec141d98e?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -196,7 +196,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:14 GMT + - Thu, 06 Jan 2022 07:49:56 GMT expires: - '-1' pragma: @@ -209,7 +209,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 6b303fff-ad0c-4176-8b6f-3d02adf4744a + - 9221c152-2fc4-441d-a807-21652a5cd17f x-ms-ratelimit-remaining-subscription-writes: - '1192' status: @@ -225,10 +225,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/10ffea68-e980-4914-91e7-9754309298e0?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/0529f563-ee0e-46d4-b888-d5eec141d98e?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -240,7 +240,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:18 GMT + - Thu, 06 Jan 2022 07:49:59 GMT expires: - '-1' pragma: @@ -257,7 +257,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - eecea12f-9c8b-4820-95d4-5318277d8695 + - 76039f68-90ef-4028-9192-2121a1ba006d status: code: 200 message: OK @@ -271,14 +271,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff/subnets/subnetx15cf0eff?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff/subnets/subnetx15cf0eff?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetx15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex15cf0eff/subnets/subnetx15cf0eff\",\r\n - \ \"etag\": \"W/\\\"cdabdfdf-cca9-4c61-899b-662fad7147c6\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"76fcebb2-7594-4f3b-806d-df71005c60d3\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": @@ -291,9 +291,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:18 GMT + - Thu, 06 Jan 2022 07:49:59 GMT etag: - - W/"cdabdfdf-cca9-4c61-899b-662fad7147c6" + - W/"76fcebb2-7594-4f3b-806d-df71005c60d3" expires: - '-1' pragma: @@ -310,7 +310,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 131bc981-d6b5-4749-83ae-c7aadb8061f1 + - ec4b6250-004e-4989-8552-25c2cf40b238 status: code: 200 message: OK @@ -329,18 +329,18 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"interfacex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff\",\r\n - \ \"etag\": \"W/\\\"b446471a-54dd-468d-a300-8361f78185f4\\\"\",\r\n \"location\": + \ \"etag\": \"W/\\\"54746f23-dfe7-47b0-baf2-7a95debd923c\\\"\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n - \ \"resourceGuid\": \"22e36c6d-bf6d-4cbe-9b19-29aceb4bc9ef\",\r\n \"ipConfigurations\": + \ \"resourceGuid\": \"ed501c39-f512-4e9c-b98e-61a7b3281e33\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"MyIpConfig\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff/ipConfigurations/MyIpConfig\",\r\n - \ \"etag\": \"W/\\\"b446471a-54dd-468d-a300-8361f78185f4\\\"\",\r\n + \ \"etag\": \"W/\\\"54746f23-dfe7-47b0-baf2-7a95debd923c\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": @@ -348,7 +348,7 @@ interactions: \ },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": - \"hhwpkipnlz5excox0jbgd25kce.bx.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": + \"etq3t1tkzyqevarn252iujzmog.bx.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"vnetEncryptionSupported\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": [],\r\n \ \"nicType\": \"Standard\"\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}" @@ -356,7 +356,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/c883c5cc-bef2-4727-8393-0d2c06b5f9eb?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/1116e767-7009-40e8-bc83-16fa9f5ef2f0?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -364,7 +364,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:19 GMT + - Thu, 06 Jan 2022 07:50:00 GMT expires: - '-1' pragma: @@ -377,7 +377,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - a7985fae-9cae-4012-97f6-8f4ad2ee3d03 + - 5ec4d448-0513-45dd-b0ed-0b4cf9d34451 x-ms-ratelimit-remaining-subscription-writes: - '1191' status: @@ -393,10 +393,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/c883c5cc-bef2-4727-8393-0d2c06b5f9eb?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/1116e767-7009-40e8-bc83-16fa9f5ef2f0?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -408,7 +408,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:49 GMT + - Thu, 06 Jan 2022 07:50:29 GMT expires: - '-1' pragma: @@ -425,7 +425,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 26c05351-90af-4354-ac5e-11f405a567a6 + - e8126812-806a-4a94-b69c-03fcf5ce305f status: code: 200 message: OK @@ -439,18 +439,18 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"interfacex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff\",\r\n - \ \"etag\": \"W/\\\"b446471a-54dd-468d-a300-8361f78185f4\\\"\",\r\n \"location\": + \ \"etag\": \"W/\\\"54746f23-dfe7-47b0-baf2-7a95debd923c\\\"\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n - \ \"resourceGuid\": \"22e36c6d-bf6d-4cbe-9b19-29aceb4bc9ef\",\r\n \"ipConfigurations\": + \ \"resourceGuid\": \"ed501c39-f512-4e9c-b98e-61a7b3281e33\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"MyIpConfig\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/networkInterfaces/interfacex15cf0eff/ipConfigurations/MyIpConfig\",\r\n - \ \"etag\": \"W/\\\"b446471a-54dd-468d-a300-8361f78185f4\\\"\",\r\n + \ \"etag\": \"W/\\\"54746f23-dfe7-47b0-baf2-7a95debd923c\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": @@ -458,7 +458,7 @@ interactions: \ },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": - \"hhwpkipnlz5excox0jbgd25kce.bx.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": + \"etq3t1tkzyqevarn252iujzmog.bx.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"vnetEncryptionSupported\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": [],\r\n \ \"nicType\": \"Standard\"\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}" @@ -470,9 +470,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:49 GMT + - Thu, 06 Jan 2022 07:50:29 GMT etag: - - W/"b446471a-54dd-468d-a300-8361f78185f4" + - W/"54746f23-dfe7-47b0-baf2-7a95debd923c" expires: - '-1' pragma: @@ -489,7 +489,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 96f3eb0c-3a9f-4763-89f5-b7ea7c335c0e + - e4d00ef6-1c99-4cd8-90a0-4e2113512584 status: code: 200 message: OK @@ -516,7 +516,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff?api-version=2021-07-01 @@ -524,12 +524,12 @@ interactions: body: string: "{\r\n \"name\": \"virtualmachinex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff\",\r\n \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n - \ \"properties\": {\r\n \"vmId\": \"cb618dc1-c323-4478-acda-f534a5b3d94d\",\r\n + \ \"properties\": {\r\n \"vmId\": \"8251ae64-33be-417e-8b12-e616eaf72145\",\r\n \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_D2_v2\"\r\n },\r\n \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": \"Windows\",\r\n \"name\": \"myVMosdisk\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\"\r\n },\r\n @@ -555,7 +555,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/00e74246-17a8-442b-85ad-d240923f799b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0432d19e-ac45-41f3-ab10-be1d640a1a0f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -563,7 +563,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:54:55 GMT + - Thu, 06 Jan 2022 07:50:33 GMT expires: - '-1' pragma: @@ -576,9 +576,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutVM3Min;684,Microsoft.Compute/PutVM30Min;3417 + - Microsoft.Compute/PutVM3Min;744,Microsoft.Compute/PutVM30Min;3728 x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1197' status: code: 201 message: Created @@ -592,14 +592,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/00e74246-17a8-442b-85ad-d240923f799b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0432d19e-ac45-41f3-ab10-be1d640a1a0f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:54:52.3815033+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"00e74246-17a8-442b-85ad-d240923f799b\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:50:32.8650263+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"0432d19e-ac45-41f3-ab10-be1d640a1a0f\"\r\n}" headers: cache-control: - no-cache @@ -608,7 +608,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:55:05 GMT + - Thu, 06 Jan 2022 07:50:42 GMT expires: - '-1' pragma: @@ -625,7 +625,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29912 + - Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29993 status: code: 200 message: OK @@ -639,14 +639,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/00e74246-17a8-442b-85ad-d240923f799b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0432d19e-ac45-41f3-ab10-be1d640a1a0f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:54:52.3815033+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"00e74246-17a8-442b-85ad-d240923f799b\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:50:32.8650263+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"0432d19e-ac45-41f3-ab10-be1d640a1a0f\"\r\n}" headers: cache-control: - no-cache @@ -655,7 +655,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:55:55 GMT + - Thu, 06 Jan 2022 07:51:33 GMT expires: - '-1' pragma: @@ -672,7 +672,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29911 + - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29992 status: code: 200 message: OK @@ -686,15 +686,109 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/00e74246-17a8-442b-85ad-d240923f799b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0432d19e-ac45-41f3-ab10-be1d640a1a0f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:54:52.3815033+00:00\",\r\n \"endTime\": - \"2021-10-12T06:56:06.9600706+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"00e74246-17a8-442b-85ad-d240923f799b\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:50:32.8650263+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"0432d19e-ac45-41f3-ab10-be1d640a1a0f\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 06 Jan 2022 07:52:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29991 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0432d19e-ac45-41f3-ab10-be1d640a1a0f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2022-01-06T07:50:32.8650263+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"0432d19e-ac45-41f3-ab10-be1d640a1a0f\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 06 Jan 2022 07:52:33 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29989 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/0432d19e-ac45-41f3-ab10-be1d640a1a0f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2022-01-06T07:50:32.8650263+00:00\",\r\n \"endTime\": + \"2022-01-06T07:53:03.7558159+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"0432d19e-ac45-41f3-ab10-be1d640a1a0f\"\r\n}" headers: cache-control: - no-cache @@ -703,7 +797,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:56:26 GMT + - Thu, 06 Jan 2022 07:53:03 GMT expires: - '-1' pragma: @@ -720,7 +814,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29909 + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29988 status: code: 200 message: OK @@ -734,7 +828,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff?api-version=2021-07-01 @@ -742,28 +836,28 @@ interactions: body: string: "{\r\n \"name\": \"virtualmachinex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff\",\r\n \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n - \ \"properties\": {\r\n \"vmId\": \"cb618dc1-c323-4478-acda-f534a5b3d94d\",\r\n + \ \"properties\": {\r\n \"vmId\": \"8251ae64-33be-417e-8b12-e616eaf72145\",\r\n \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_D2_v2\"\r\n },\r\n \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": \"Windows\",\r\n \"name\": \"myVMosdisk\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/myVMosdisk\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 127\r\n },\r\n \"dataDisks\": [\r\n {\r\n \"lun\": - 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\",\r\n + 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n },\r\n {\r\n - \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\",\r\n + \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n }\r\n ]\r\n },\r\n \ \"osProfile\": {\r\n \"computerName\": \"myVM\",\r\n \"adminUsername\": @@ -782,7 +876,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:56:26 GMT + - Thu, 06 Jan 2022 07:53:03 GMT expires: - '-1' pragma: @@ -799,7 +893,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3989,Microsoft.Compute/LowCostGet30Min;31589 + - Microsoft.Compute/LowCostGet3Min;3999,Microsoft.Compute/LowCostGet30Min;31996 status: code: 200 message: OK @@ -819,7 +913,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 @@ -836,7 +930,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/da14420e-db07-49ae-9851-3a47c9d96044?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/babc551b-4719-4eb3-a7ea-70d99a9f373a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -844,7 +938,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:56:27 GMT + - Thu, 06 Jan 2022 07:53:04 GMT expires: - '-1' pragma: @@ -859,7 +953,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/UpdateVM3Min;239,Microsoft.Compute/UpdateVM30Min;1199 x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - '1196' status: code: 201 message: Created @@ -873,14 +967,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/da14420e-db07-49ae-9851-3a47c9d96044?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/babc551b-4719-4eb3-a7ea-70d99a9f373a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:56:27.2102184+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"da14420e-db07-49ae-9851-3a47c9d96044\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:53:04.7870673+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"babc551b-4719-4eb3-a7ea-70d99a9f373a\"\r\n}" headers: cache-control: - no-cache @@ -889,7 +983,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:56:57 GMT + - Thu, 06 Jan 2022 07:53:34 GMT expires: - '-1' pragma: @@ -906,7 +1000,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14992,Microsoft.Compute/GetOperation30Min;29905 + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29987 status: code: 200 message: OK @@ -920,14 +1014,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/da14420e-db07-49ae-9851-3a47c9d96044?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/babc551b-4719-4eb3-a7ea-70d99a9f373a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:56:27.2102184+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"da14420e-db07-49ae-9851-3a47c9d96044\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:53:04.7870673+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"babc551b-4719-4eb3-a7ea-70d99a9f373a\"\r\n}" headers: cache-control: - no-cache @@ -936,7 +1030,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:57:28 GMT + - Thu, 06 Jan 2022 07:54:04 GMT expires: - '-1' pragma: @@ -953,7 +1047,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14991,Microsoft.Compute/GetOperation30Min;29904 + - Microsoft.Compute/GetOperation3Min;14993,Microsoft.Compute/GetOperation30Min;29986 status: code: 200 message: OK @@ -967,14 +1061,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/da14420e-db07-49ae-9851-3a47c9d96044?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/babc551b-4719-4eb3-a7ea-70d99a9f373a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:56:27.2102184+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"da14420e-db07-49ae-9851-3a47c9d96044\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:53:04.7870673+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"babc551b-4719-4eb3-a7ea-70d99a9f373a\"\r\n}" headers: cache-control: - no-cache @@ -983,7 +1077,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:57:57 GMT + - Thu, 06 Jan 2022 07:54:35 GMT expires: - '-1' pragma: @@ -1000,7 +1094,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14990,Microsoft.Compute/GetOperation30Min;29903 + - Microsoft.Compute/GetOperation3Min;14992,Microsoft.Compute/GetOperation30Min;29984 status: code: 200 message: OK @@ -1014,15 +1108,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/da14420e-db07-49ae-9851-3a47c9d96044?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/babc551b-4719-4eb3-a7ea-70d99a9f373a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:56:27.2102184+00:00\",\r\n \"endTime\": - \"2021-10-12T06:58:11.4295817+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"da14420e-db07-49ae-9851-3a47c9d96044\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:53:04.7870673+00:00\",\r\n \"endTime\": + \"2022-01-06T07:54:58.9590041+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"babc551b-4719-4eb3-a7ea-70d99a9f373a\"\r\n}" headers: cache-control: - no-cache @@ -1031,7 +1125,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:28 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' pragma: @@ -1048,7 +1142,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14987,Microsoft.Compute/GetOperation30Min;29899 + - Microsoft.Compute/GetOperation3Min;14991,Microsoft.Compute/GetOperation30Min;29988 status: code: 200 message: OK @@ -1062,7 +1156,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 @@ -1083,7 +1177,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:28 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' pragma: @@ -1100,7 +1194,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3922,Microsoft.Compute/LowCostGet30Min;31518 + - Microsoft.Compute/LowCostGet3Min;3993,Microsoft.Compute/LowCostGet30Min;31991 status: code: 200 message: OK @@ -1114,58 +1208,58 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/instanceView?api-version=2021-07-01 response: body: string: "{\r\n \"computerName\": \"myVM\",\r\n \"osName\": \"Windows Server - 2016 Datacenter\",\r\n \"osVersion\": \"Windows:Windows Server 2016 Datacenter-10.0.14393.4651\",\r\n - \ \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.7.41491.1024\",\r\n \"statuses\": - [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": + 2016 Datacenter\",\r\n \"osVersion\": \"10.0.14393.4825\",\r\n \"vmAgent\": + {\r\n \"vmAgentVersion\": \"2.7.41491.1032\",\r\n \"statuses\": [\r\n + \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": \"GuestAgent is running and processing the extensions.\",\r\n \"time\": - \"2021-10-12T06:58:07+00:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": + \"2022-01-06T07:54:57.439+00:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n {\r\n \"type\": \"Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentWindows\",\r\n - \ \"typeHandlerVersion\": \"1.4.1974.1\",\r\n \"status\": {\r\n + \ \"typeHandlerVersion\": \"1.4.2059.1\",\r\n \"status\": {\r\n \ \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": \"Plugin enabled (handler name: Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentWindows, - extension name: , version: 1.4.1974.1).\"\r\n }\r\n }\r\n ]\r\n + extension name: , version: 1.4.2059.1).\"\r\n }\r\n }\r\n ]\r\n \ },\r\n \"disks\": [\r\n {\r\n \"name\": \"myVMosdisk\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-10-12T06:54:56.6315006+00:00\"\r\n - \ }\r\n ]\r\n },\r\n {\r\n \"name\": \"virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\",\r\n + succeeded\",\r\n \"time\": \"2022-01-06T07:50:36.2088022+00:00\"\r\n + \ }\r\n ]\r\n },\r\n {\r\n \"name\": \"virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-10-12T06:54:56.6315006+00:00\"\r\n - \ }\r\n ]\r\n },\r\n {\r\n \"name\": \"virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\",\r\n + succeeded\",\r\n \"time\": \"2022-01-06T07:50:36.2088022+00:00\"\r\n + \ }\r\n ]\r\n },\r\n {\r\n \"name\": \"virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-10-12T06:54:56.6315006+00:00\"\r\n + succeeded\",\r\n \"time\": \"2022-01-06T07:50:36.2088022+00:00\"\r\n \ }\r\n ]\r\n }\r\n ],\r\n \"extensions\": [\r\n {\r\n \ \"name\": \"virtualmachineextensionx15cf0eff\",\r\n \"type\": \"Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentWindows\",\r\n - \ \"typeHandlerVersion\": \"1.4.1974.1\",\r\n \"statuses\": [\r\n + \ \"typeHandlerVersion\": \"1.4.2059.1\",\r\n \"statuses\": [\r\n \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n \ \"message\": \"Plugin enabled (handler name: Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentWindows, - extension name: , version: 1.4.1974.1).\"\r\n }\r\n ]\r\n }\r\n + extension name: , version: 1.4.2059.1).\"\r\n }\r\n ]\r\n }\r\n \ ],\r\n \"hyperVGeneration\": \"V1\",\r\n \"statuses\": [\r\n {\r\n \ \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n - \ \"displayStatus\": \"Provisioning succeeded\",\r\n \"time\": \"2021-10-12T06:58:11.4295817+00:00\"\r\n + \ \"displayStatus\": \"Provisioning succeeded\",\r\n \"time\": \"2022-01-06T07:54:58.9590041+00:00\"\r\n \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n }\r\n ]\r\n}" headers: cache-control: - no-cache content-length: - - '2833' + - '2798' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:28 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' pragma: @@ -1182,7 +1276,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3921,Microsoft.Compute/LowCostGet30Min;31517 + - Microsoft.Compute/LowCostGet3Min;3992,Microsoft.Compute/LowCostGet30Min;31990 status: code: 200 message: OK @@ -1196,7 +1290,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 @@ -1217,7 +1311,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:28 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' pragma: @@ -1234,7 +1328,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3920,Microsoft.Compute/LowCostGet30Min;31516 + - Microsoft.Compute/LowCostGet3Min;3991,Microsoft.Compute/LowCostGet30Min;31989 status: code: 200 message: OK @@ -1248,7 +1342,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/runCommands/RunPowerShellScript?api-version=2021-07-01 @@ -1256,25 +1350,25 @@ interactions: body: string: "{\r\n \"script\": [\r\n \"param(\\r\\n [string]$arg1,\\r\\n [string]$arg2\\r\\n)\\r\\nWrite-Host This is a sample script with parameters $arg1 $arg2\\r\\n\\r\\n# SIG # Begin - signature block\\r\\n# MIIjhgYJKoZIhvcNAQcCoIIjdzCCI3MCAQExDzANBglghkgBZQMEAgEFADB5Bgor\\r\\n# + signature block\\r\\n# MIIjkgYJKoZIhvcNAQcCoIIjgzCCI38CAQExDzANBglghkgBZQMEAgEFADB5Bgor\\r\\n# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG\\r\\n# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB6jm9GJUxEj/xj\\r\\n# - xRn7NMmK1YlgeGDCHEVx3xVyCBNnmaCCDYEwggX/MIID56ADAgECAhMzAAAB32vw\\r\\n# LpKnSrTQAAAAAAHfMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD\\r\\n# + xRn7NMmK1YlgeGDCHEVx3xVyCBNnmaCCDYEwggX/MIID56ADAgECAhMzAAACUosz\\r\\n# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD\\r\\n# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy\\r\\n# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p\\r\\n# - bmcgUENBIDIwMTEwHhcNMjAxMjE1MjEzMTQ1WhcNMjExMjAyMjEzMTQ1WjB0MQsw\\r\\n# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u\\r\\n# + bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw\\r\\n# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u\\r\\n# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy\\r\\n# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\\r\\n# - AQC2uxlZEACjqfHkuFyoCwfL25ofI9DZWKt4wEj3JBQ48GPt1UsDv834CcoUUPMn\\r\\n# s/6CtPoaQ4Thy/kbOOg/zJAnrJeiMQqRe2Lsdb/NSI2gXXX9lad1/yPUDOXo4GNw\\r\\n# - PjXq1JZi+HZV91bUr6ZjzePj1g+bepsqd/HC1XScj0fT3aAxLRykJSzExEBmU9eS\\r\\n# yuOwUuq+CriudQtWGMdJU650v/KmzfM46Y6lo/MCnnpvz3zEL7PMdUdwqj/nYhGG\\r\\n# - 3UVILxX7tAdMbz7LN+6WOIpT1A41rwaoOVnv+8Ua94HwhjZmu1S73yeV7RZZNxoh\\r\\n# EegJi9YYssXa7UZUUkCCA+KnAgMBAAGjggF+MIIBejAfBgNVHSUEGDAWBgorBgEE\\r\\n# - AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUOPbML8IdkNGtCfMmVPtvI6VZ8+Mw\\r\\n# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1\\r\\n# - ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzAwMTIrNDYzMDA5MB8GA1UdIwQYMBaAFEhu\\r\\n# ZOVQBdOCqhc3NyK1bajKdQKVMFQGA1UdHwRNMEswSaBHoEWGQ2h0dHA6Ly93d3cu\\r\\n# + AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4xMShjIou2I\\r\\n# sbYnF67wXzVAq5Om4oe+LfzSDOzjcb6ms00gBo0OQaqwQ1BijyJ7NvDf80I1fW9O\\r\\n# + L76Kt0Wpc2zrGhzcHdb7upPrvxvSNNUvxK3sgw7YTt31410vpEp8yfBEl/hd8ZzA\\r\\n# v47DCgJ5j1zm295s1RVZHNp6MoiQFVOECm4AwK2l28i+YER1JO4IplTH44uvzX9o\\r\\n# + RnJHaMvWzZEpozPy4jNO2DDqbcNs4zh7AWMhE1PWFVA+CHI/En5nASvCvLmuR/t8\\r\\n# q4bc8XR8QIZJQSp+2U6m2ldNAgMBAAGjggF+MIIBejAfBgNVHSUEGDAWBgorBgEE\\r\\n# + AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUNZJaEUGL2Guwt7ZOAu4efEYXedEw\\r\\n# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1\\r\\n# + ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzAwMTIrNDY3NTk3MB8GA1UdIwQYMBaAFEhu\\r\\n# ZOVQBdOCqhc3NyK1bajKdQKVMFQGA1UdHwRNMEswSaBHoEWGQ2h0dHA6Ly93d3cu\\r\\n# bWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY0NvZFNpZ1BDQTIwMTFfMjAxMS0w\\r\\n# Ny0wOC5jcmwwYQYIKwYBBQUHAQEEVTBTMFEGCCsGAQUFBzAChkVodHRwOi8vd3d3\\r\\n# - Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY0NvZFNpZ1BDQTIwMTFfMjAx\\r\\n# MS0wNy0wOC5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAnnqH\\r\\n# - tDyYUFaVAkvAK0eqq6nhoL95SZQu3RnpZ7tdQ89QR3++7A+4hrr7V4xxmkB5BObS\\r\\n# 0YK+MALE02atjwWgPdpYQ68WdLGroJZHkbZdgERG+7tETFl3aKF4KpoSaGOskZXp\\r\\n# - TPnCaMo2PXoAMVMGpsQEQswimZq3IQ3nRQfBlJ0PoMMcN/+Pks8ZTL1BoPYsJpok\\r\\n# t6cql59q6CypZYIwgyJ892HpttybHKg1ZtQLUlSXccRMlugPgEcNZJagPEgPYni4\\r\\n# - b11snjRAgf0dyQ0zI9aLXqTxWUU5pCIFiPT0b2wsxzRqCtyGqpkGM8P9GazO8eao\\r\\n# mVItCYBcJSByBx/pS0cSYwBBHAZxJODUqxSXoSGDvmTfqUJXntnWkL4okok1FiCD\\r\\n# - Z4jpyXOQunb6egIXvkgQ7jb2uO26Ow0m8RwleDvhOMrnHsupiOPbozKroSa6paFt\\r\\n# VSh89abUSooR8QdZciemmoFhcWkEwFg4spzvYNP4nIs193261WyTaRMZoceGun7G\\r\\n# - CT2Rl653uUj+F+g94c63AhzSq4khdL4HlFIP2ePv29smfUnHtGq6yYFDLnT0q/Y+\\r\\n# Di3jwloF8EWkkHRtSuXlFUbTmwr/lDDgbpZiKhLS7CBTDj32I0L5i532+uHczw82\\r\\n# - oZDmYmYmIUSMbZOgS65h797rj5JJ6OkeEUJoAVwwggd6MIIFYqADAgECAgphDpDS\\r\\n# AAAAAAADMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMK\\r\\n# + Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY0NvZFNpZ1BDQTIwMTFfMjAx\\r\\n# MS0wNy0wOC5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAFkk3\\r\\n# + uSxkTEBh1NtAl7BivIEsAWdgX1qZ+EdZMYbQKasY6IhSLXRMxF1B3OKdR9K/kccp\\r\\n# kvNcGl8D7YyYS4mhCUMBR+VLrg3f8PUj38A9V5aiY2/Jok7WZFOAmjPRNNGnyeg7\\r\\n# + l0lTiThFqE+2aOs6+heegqAdelGgNJKRHLWRuhGKuLIw5lkgx9Ky+QvZrn/Ddi8u\\r\\n# TIgWKp+MGG8xY6PBvvjgt9jQShlnPrZ3UY8Bvwy6rynhXBaV0V0TTL0gEx7eh/K1\\r\\n# + o8Miaru6s/7FyqOLeUS4vTHh9TgBL5DtxCYurXbSBVtL1Fj44+Od/6cmC9mmvrti\\r\\n# yG709Y3Rd3YdJj2f3GJq7Y7KdWq0QYhatKhBeg4fxjhg0yut2g6aM1mxjNPrE48z\\r\\n# + 6HWCNGu9gMK5ZudldRw4a45Z06Aoktof0CqOyTErvq0YjoE4Xpa0+87T/PVUXNqf\\r\\n# 7Y+qSU7+9LtLQuMYR4w3cSPjuNusvLf9gBnch5RqM7kaDtYWDgLyB42EfsxeMqwK\\r\\n# + WwA+TVi0HrWRqfSx2olbE56hJcEkMjOSKz3sRuupFCX3UroyYf52L+2iVTrda8XW\\r\\n# esPG62Mnn3T8AuLfzeJFuAbfOSERx7IFZO92UPoXE1uEjL5skl1yTZB3MubgOA4F\\r\\n# + 8KoRNhviFAEST+nG8c8uIsbZeb08SeYQMqjVEmkwggd6MIIFYqADAgECAgphDpDS\\r\\n# AAAAAAADMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMK\\r\\n# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0\\r\\n# IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0\\r\\n# ZSBBdXRob3JpdHkgMjAxMTAeFw0xMTA3MDgyMDU5MDlaFw0yNjA3MDgyMTA5MDla\\r\\n# MH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS\\r\\n# ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMT\\r\\n# H01pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBIDIwMTEwggIiMA0GCSqGSIb3DQEB\\r\\n# @@ -1294,68 +1388,68 @@ interactions: wzIY4vDFLc5bnrRJOQrGCsLGra7lstnbFYhRRVg4MnEnGn+x9Cf43iw6IGmYslmJ\\r\\n# aG5vp7d0w0AFBqYBKig+gj8TTWYLwLNN9eGPfxxvFX1Fp3blQCplo8NdUmKGwx1j\\r\\n# NpeG39rz+PIWoZon4c2ll9DuXWNB41sHnIc+BncG0QaxdR8UvmFhtfDcxhsEvt9B\\r\\n# xw4o7t5lL+yX9qFcltgA1qFGvVnzl6UJS0gQmYAf0AApxbGbpT9Fdx41xtKiop96\\r\\n# eiL6SJUfq/tHI4D1nvi/a7dLl+LrdXga7Oo3mXkYS//WsyNodeav+vyL6wuA6mk7\\r\\n# r/ww7QRMjt/fdW1jkT3RnVZOT7+AVyKheBEyIXrvQQqxP/uozKRdwaGIm1dxVk5I\\r\\n# - RcBCyZt2WwqASGv9eZ/BvW1taslScxMNelDNMYIVWzCCFVcCAQEwgZUwfjELMAkG\\r\\n# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx\\r\\n# - HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEoMCYGA1UEAxMfTWljcm9z\\r\\n# b2Z0IENvZGUgU2lnbmluZyBQQ0EgMjAxMQITMwAAAd9r8C6Sp0q00AAAAAAB3zAN\\r\\n# + RcBCyZt2WwqASGv9eZ/BvW1taslScxMNelDNMYIVZzCCFWMCAQEwgZUwfjELMAkG\\r\\n# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx\\r\\n# + HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEoMCYGA1UEAxMfTWljcm9z\\r\\n# b2Z0IENvZGUgU2lnbmluZyBQQ0EgMjAxMQITMwAAAlKLM6r4lfM52wAAAAACUjAN\\r\\n# BglghkgBZQMEAgEFAKCBrjAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgor\\r\\n# BgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgtFV7nVIA\\r\\n# MzAyvGRGFyVFPBXkTNlNDitxIkf6V1ugHIUwQgYKKwYBBAGCNwIBDDE0MDKgFIAS\\r\\n# AE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbTAN\\r\\n# - BgkqhkiG9w0BAQEFAASCAQCdcZkwG3N2yyK8zjw+MCmVYaQKrdUoDeuk/eGP1cNs\\r\\n# 2/0LZ1Nl5T1BXbVxIXU8gqL9GzokG58Fo1kTzUx0Vk/mJyAaV+KHVPDe0pIfreZL\\r\\n# - cosVVdCKCXc6zhBrapOG/fY5bmrhSMVsGGe04uvInKlItOltcAc1xx/z3yl3e4L7\\r\\n# d1esSaFrr+e95j4YwkCuQ8cUiAMWi9817841qYi36oIwVgsE29/d2b7+l5S2eEDy\\r\\n# - 0Umdiz2jWVXfSA6CePldzhOk5ySI5ShcBpn2b132gIs5lWlj3r1OD/lkOgOjQhSN\\r\\n# khCltIJso0c+f+LP822OJeHCSc1S6aKMH54rsrLZlSr9oYIS5TCCEuEGCisGAQQB\\r\\n# - gjcDAwExghLRMIISzQYJKoZIhvcNAQcCoIISvjCCEroCAQMxDzANBglghkgBZQME\\r\\n# AgEFADCCAVEGCyqGSIb3DQEJEAEEoIIBQASCATwwggE4AgEBBgorBgEEAYRZCgMB\\r\\n# - MDEwDQYJYIZIAWUDBAIBBQAEICye+7PcMlsaxZQZ4xS/CJz3pTAcisYNJPqQgd+y\\r\\n# OPl2AgZhRLoOD20YEzIwMjEwOTE5MjIwNTI4LjAxOVowBIACAfSggdCkgc0wgcox\\r\\n# - CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt\\r\\n# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJTAjBgNVBAsTHE1p\\r\\n# - Y3Jvc29mdCBBbWVyaWNhIE9wZXJhdGlvbnMxJjAkBgNVBAsTHVRoYWxlcyBUU1Mg\\r\\n# RVNOOkFFMkMtRTMyQi0xQUZDMSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFt\\r\\n# - cCBTZXJ2aWNloIIOPDCCBPEwggPZoAMCAQICEzMAAAFIoohFVrwvgL8AAAAAAUgw\\r\\n# DQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0\\r\\n# - b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh\\r\\n# dGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwHhcN\\r\\n# - MjAxMTEyMTgyNTU2WhcNMjIwMjExMTgyNTU2WjCByjELMAkGA1UEBhMCVVMxEzAR\\r\\n# BgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1p\\r\\n# - Y3Jvc29mdCBDb3Jwb3JhdGlvbjElMCMGA1UECxMcTWljcm9zb2Z0IEFtZXJpY2Eg\\r\\n# T3BlcmF0aW9uczEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046QUUyQy1FMzJCLTFB\\r\\n# - RkMxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2UwggEiMA0G\\r\\n# CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD3/3ivFYSK0dGtcXaZ8pNLEARbraJe\\r\\n# - wryi/JgbaKlq7hhFIU1EkY0HMiFRm2/Wsukt62k25zvDxW16fphg5876+l1wYnCl\\r\\n# ge/rFlrR2Uu1WwtFmc1xGpy4+uxobCEMeIFDGhL5DNTbbOisLrBUYbyXr7fPzxbV\\r\\n# - kEwJDP5FG2n0ro1qOjegIkLIjXU6qahduQxTfsPOEp8jgqMKn++fpH6fvXKlewWz\\r\\n# dsfvhiZ4H4Iq1CTOn+fkxqcDwTHYkYZYgqm+1X1x7458rp69qjFeVP3GbAvJbY3b\\r\\n# - Flq5uyxriPcZxDZrB6f1wALXrO2/IdfVEdwTWqJIDZBJjTycQhhxS3i1AgMBAAGj\\r\\n# ggEbMIIBFzAdBgNVHQ4EFgQUhzLwaZ8OBLRJH0s9E63pIcWJokcwHwYDVR0jBBgw\\r\\n# - FoAU1WM6XIoxkPNDe3xGG8UzaFqFbVUwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDov\\r\\n# L2NybC5taWNyb3NvZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvTWljVGltU3RhUENB\\r\\n# - XzIwMTAtMDctMDEuY3JsMFoGCCsGAQUFBwEBBE4wTDBKBggrBgEFBQcwAoY+aHR0\\r\\n# cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNUaW1TdGFQQ0FfMjAx\\r\\n# - MC0wNy0wMS5jcnQwDAYDVR0TAQH/BAIwADATBgNVHSUEDDAKBggrBgEFBQcDCDAN\\r\\n# BgkqhkiG9w0BAQsFAAOCAQEAZhKWwbMnC9Qywcrlgs0qX9bhxiZGve+8JED27hOi\\r\\n# - yGa8R9nqzHg4+q6NKfYXfS62uMUJp2u+J7tINUTf/1ugL+K4RwsPVehDasSJJj+7\\r\\n# boIxZP8AU/xQdVY7qgmQGmd4F+c5hkJJtl6NReYE908Q698qj1mDpr0Mx+4LhP/t\\r\\n# - TqL6HpZEURlhFOddnyLStVCFdfNI1yGHP9n0yN1KfhGEV3s7MBzpFJXwOflwgyE9\\r\\n# cwQ8jjOTVpNRdCqL/P5ViCAo2dciHjd1u1i1Q4QZ6xb0+B1HdZFRELOiFwf0sh3Z\\r\\n# - 1xOeSFcHg0rLE+rseHz4QhvoEj7h9bD8VN7/HnCDwWpBJTCCBnEwggRZoAMCAQIC\\r\\n# CmEJgSoAAAAAAAIwDQYJKoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYD\\r\\n# - VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy\\r\\n# b3NvZnQgQ29ycG9yYXRpb24xMjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRp\\r\\n# - ZmljYXRlIEF1dGhvcml0eSAyMDEwMB4XDTEwMDcwMTIxMzY1NVoXDTI1MDcwMTIx\\r\\n# NDY1NVowfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNV\\r\\n# - BAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQG\\r\\n# A1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwggEiMA0GCSqGSIb3\\r\\n# - DQEBAQUAA4IBDwAwggEKAoIBAQCpHQ28dxGKOiDs/BOX9fp/aZRrdFQQ1aUKAIKF\\r\\n# ++18aEssX8XD5WHCdrc+Zitb8BVTJwQxH0EbGpUdzgkTjnxhMFmxMEQP8WCIhFRD\\r\\n# - DNdNuDgIs0Ldk6zWczBXJoKjRQ3Q6vVHgc2/JGAyWGBG8lhHhjKEHnRhZ5FfgVSx\\r\\n# z5NMksHEpl3RYRNuKMYa+YaAu99h/EbBJx0kZxJyGiGKr0tkiVBisV39dx898Fd1\\r\\n# - rL2KQk1AUdEPnAY+Z3/1ZsADlkR+79BL/W7lmsqxqPJ6Kgox8NpOBpG2iAg16Hgc\\r\\n# sOmZzTznL0S6p/TcZL2kAcEgCZN4zfy8wMlEXV4WnAEFTyJNAgMBAAGjggHmMIIB\\r\\n# - 4jAQBgkrBgEEAYI3FQEEAwIBADAdBgNVHQ4EFgQU1WM6XIoxkPNDe3xGG8UzaFqF\\r\\n# bVUwGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud\\r\\n# - EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU1fZWy4/oolxiaNE9lJBb186aGMQwVgYD\\r\\n# VR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraS9jcmwv\\r\\n# - cHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3JsMFoGCCsGAQUFBwEB\\r\\n# BE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9j\\r\\n# - ZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcnQwgaAGA1UdIAEB/wSBlTCB\\r\\n# kjCBjwYJKwYBBAGCNy4DMIGBMD0GCCsGAQUFBwIBFjFodHRwOi8vd3d3Lm1pY3Jv\\r\\n# - c29mdC5jb20vUEtJL2RvY3MvQ1BTL2RlZmF1bHQuaHRtMEAGCCsGAQUFBwICMDQe\\r\\n# MiAdAEwAZQBnAGEAbABfAFAAbwBsAGkAYwB5AF8AUwB0AGEAdABlAG0AZQBuAHQA\\r\\n# - LiAdMA0GCSqGSIb3DQEBCwUAA4ICAQAH5ohRDeLG4Jg/gXEDPZ2joSFvs+umzPUx\\r\\n# vs8F4qn++ldtGTCzwsVmyWrf9efweL3HqJ4l4/m87WtUVwgrUYJEEvu5U4zM9GAS\\r\\n# - inbMQEBBm9xcF/9c+V4XNZgkVkt070IQyK+/f8Z/8jd9Wj8c8pl5SpFSAK84Dxf1\\r\\n# L3mBZdmptWvkx872ynoAb0swRCQiPM/tA6WWj1kpvLb9BOFwnzJKJ/1Vry/+tuWO\\r\\n# - M7tiX5rbV0Dp8c6ZZpCM/2pif93FSguRJuI57BlKcWOdeyFtw5yjojz6f32WapB4\\r\\n# pm3S4Zz5Hfw42JT0xqUKloakvZ4argRCg7i1gJsiOCC1JeVk7Pf0v35jWSUPei45\\r\\n# - V3aicaoGig+JFrphpxHLmtgOR5qAxdDNp9DvfYPw4TtxCd9ddJgiCGHasFAeb73x\\r\\n# 4QDf5zEHpJM692VHeOj4qEir995yfmFrb3epgcunCaw5u+zGy9iCtHLNHfS4hQEe\\r\\n# - gPsbiSpUObJb2sgNVZl6h3M7COaYLeqN4DMuEin1wC9UJyH3yKxO2ii4sanblrKn\\r\\n# QqLJzxlBTeCG+SqaoxFmMNO7dDJL32N79ZmKLxvHIa9Zta7cRDyXUHHXodLFVeNp\\r\\n# - 3lfB0d4wwP3M5k37Db9dT+mdHhk4L7zPWAUu7w2gUDXa7wknHNWzfjUeCLraNtvT\\r\\n# X4/edIhJEqGCAs4wggI3AgEBMIH4oYHQpIHNMIHKMQswCQYDVQQGEwJVUzETMBEG\\r\\n# - A1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWlj\\r\\n# cm9zb2Z0IENvcnBvcmF0aW9uMSUwIwYDVQQLExxNaWNyb3NvZnQgQW1lcmljYSBP\\r\\n# - cGVyYXRpb25zMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpBRTJDLUUzMkItMUFG\\r\\n# QzElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIjCgEBMAcG\\r\\n# - BSsOAwIaAxUAhyuClrocWf4SIcRafAEX1Rhs6zmggYMwgYCkfjB8MQswCQYDVQQG\\r\\n# EwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwG\\r\\n# - A1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQg\\r\\n# VGltZS1TdGFtcCBQQ0EgMjAxMDANBgkqhkiG9w0BAQUFAAIFAOTx24swIhgPMjAy\\r\\n# - MTA5MTkyMzUzNDdaGA8yMDIxMDkyMDIzNTM0N1owdzA9BgorBgEEAYRZCgQBMS8w\\r\\n# LTAKAgUA5PHbiwIBADAKAgEAAgIX7AIB/zAHAgEAAgIRMTAKAgUA5PMtCwIBADA2\\r\\n# - BgorBgEEAYRZCgQCMSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAIDB6EgoQowCAIB\\r\\n# AAIDAYagMA0GCSqGSIb3DQEBBQUAA4GBAF1XJOJLsiZijjuY3sZcT9hIVTtEVjtS\\r\\n# - j6GmleBTx98Lur8qeixLMtG3SHHxCZGLXrsUaiz4kxzO/iP0cjulvKIEwM41jGwe\\r\\n# 99hOLcKDgq5/s9SmIvw2awf4VYfRT2LQ1cVQppU2rF1g9j/W8ywkUX45tJmjZeN1\\r\\n# - l2qIvy4CcKM3MYIDDTCCAwkCAQEwgZMwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgT\\r\\n# Cldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29m\\r\\n# - dCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENB\\r\\n# IDIwMTACEzMAAAFIoohFVrwvgL8AAAAAAUgwDQYJYIZIAWUDBAIBBQCgggFKMBoG\\r\\n# - CSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAvBgkqhkiG9w0BCQQxIgQg8dZ+j8h1\\r\\n# 7FazynXKCRpoU+c5GNhRSUfKCOpLwp7JHPswgfoGCyqGSIb3DQEJEAIvMYHqMIHn\\r\\n# - MIHkMIG9BCCpkBrqjHmhvyYf5tTcTvD5Y4a+V79TwVV6T1aAwdto2DCBmDCBgKR+\\r\\n# MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS\\r\\n# - ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMT\\r\\n# HU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAABSKKIRVa8L4C/AAAA\\r\\n# - AAFIMCIEIOihzzNb1N7twQwiiV9BQAUWE8VTPiiKj16NIuF65747MA0GCSqGSIb3\\r\\n# DQEBCwUABIIBAKJ8iZlnyCU3i04w4cHfJ2cQcokOFnlvQthfoMw1fp4RJWLNZ+Pf\\r\\n# - /X0M2pW8gfEAyUB1zPHm39zB+seFT3DKCq/nJyjmF91bFEmcxRjumAt/WGw2+Ie1\\r\\n# qf/4xL3caDtr1SQ7qNiWFOsArVPetAMU4bkx3QX+f1Eee4bM5bpRfMiQvgxEBtW9\\r\\n# - nTbuwlENXit+s6IkHrwCyTWf0oGwkz8RvD8aIP24eU5ff2Wc6aKlNo10xS3Bh2Pn\\r\\n# VdHqApH8YYUr42cjw0RT1x7/pCn6wtqWVd6+yVChz84XqdHoJ5JtFsjc79DJ+Ubo\\r\\n# - wVczJpODlc+jSx90Pbu/awO8LF3WHxoNHME=\\r\\n# SIG # End signature block\\r\\n\"\r\n - \ ],\r\n \"parameters\": [\r\n {\r\n \"name\": \"arg1\",\r\n \"type\": - \"string\",\r\n \"required\": false\r\n },\r\n {\r\n \"name\": - \"arg2\",\r\n \"type\": \"string\",\r\n \"required\": false\r\n - \ }\r\n ],\r\n \"$schema\": \"http://schema.management.azure.com/schemas/2016-11-17/runcommands.json\",\r\n + BgkqhkiG9w0BAQEFAASCAQBBF7h/mnGfKvH7cy53p+m30bTViZnDWrI4X3he8oIP\\r\\n# g0tU1PpDXsQ0QEY78RlUTvYJwCegxjE2ASi+SUB4UlYcRuAYSncvbWyTIdMawgea\\r\\n# + 2XH91WZx+j6FmrLOliNGI+D5HLmUqjNQddwQSaboG5H/n9dLM8lR3Q8wBcPk7GDM\\r\\n# x2D7hKJz0uUHhIL9JvZ5tLtTRP96ZK7HGx1a0ZfCD9M6bcbaNlkoq5z4wKSntIr9\\r\\n# + BGvJF9bnofJE1OmCYOYRXJ462ek14gfKqzAHFQYLnX1+eABPQ4H8dk/G22hhMUDM\\r\\n# beMBnjaAUEkq+7ae9tBCSEYnBw+qzuYMwfeJqUcP4YnsoYIS8TCCEu0GCisGAQQB\\r\\n# + gjcDAwExghLdMIIS2QYJKoZIhvcNAQcCoIISyjCCEsYCAQMxDzANBglghkgBZQME\\r\\n# AgEFADCCAVUGCyqGSIb3DQEJEAEEoIIBRASCAUAwggE8AgEBBgorBgEEAYRZCgMB\\r\\n# + MDEwDQYJYIZIAWUDBAIBBQAEIHD8JfzhDrdEy3ggHyPkCYTNkOFBMyL5x0/ePpcw\\r\\n# +Nl/AgZhk98ndbUYEzIwMjExMjE3MDMxNTMxLjg4OFowBIACAfSggdSkgdEwgc4x\\r\\n# + CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt\\r\\n# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1p\\r\\n# + Y3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNvMSYwJAYDVQQLEx1UaGFsZXMg\\r\\n# VFNTIEVTTjozMkJELUUzRDUtM0IxRDElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUt\\r\\n# + U3RhbXAgU2VydmljZaCCDkQwggT1MIID3aADAgECAhMzAAABYtD+AvMB5c1JAAAA\\r\\n# AAFiMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNo\\r\\n# + aW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y\\r\\n# cG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEw\\r\\n# + MB4XDTIxMDExNDE5MDIyMloXDTIyMDQxMTE5MDIyMlowgc4xCzAJBgNVBAYTAlVT\\r\\n# MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQK\\r\\n# + ExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVy\\r\\n# YXRpb25zIFB1ZXJ0byBSaWNvMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjozMkJE\\r\\n# + LUUzRDUtM0IxRDElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2Vydmlj\\r\\n# ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO+GodT2ucL3Mr2DQsv2\\r\\n# + ELNbSvKyBpYdUKtUBWiZmFVy18pG/pucgkrc5i9tu8CY7GpWV/CQNmHG2mVeSHMJ\\r\\n# vbwCc/AAv7JP3bFCt6Zg75IbVSNOGA1eqLbmQiC6UAfSKXLN3dHtQ5diihb3Ymzp\\r\\n# + NP9K0cVPZfv2MXm+ZVU0RES8cyPkXel7+UEGE+kqdiBNDdb8yBXd8sju+90+V4nz\\r\\n# YC+ZWW7SFJ2FFZlASpVaHpjv+eGohXlQaSBvmM4Q0xe3LhzQM8ViGz9cLeFSKgFf\\r\\n# + SY7qizL7wUg+eqYvDUyjPX8axEQHmk0th23wWH5p0Wduws43qNIo0OQ0mRotBK71\\r\\n# nykCAwEAAaOCARswggEXMB0GA1UdDgQWBBTLxEoRYEpDtzp84B5WlZN2kP4qazAf\\r\\n# + BgNVHSMEGDAWgBTVYzpcijGQ80N7fEYbxTNoWoVtVTBWBgNVHR8ETzBNMEugSaBH\\r\\n# hkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNU\\r\\n# + aW1TdGFQQ0FfMjAxMC0wNy0wMS5jcmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUF\\r\\n# BzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1RpbVN0\\r\\n# + YVBDQV8yMDEwLTA3LTAxLmNydDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsG\\r\\n# AQUFBwMIMA0GCSqGSIb3DQEBCwUAA4IBAQAtQa3DoXYbW/cXACbcVSFGe4gC8GXs\\r\\n# + FxSHT3JgwFU/NdJOcbkcFTVvTp6vlmTvHm6sIjknRBB0Xi1NBTqPw20u6u/T7Cnc\\r\\n# /z0gT6mf9crI0VR9C+R1CtjezYKZEdZZ7fuNQWjsyftNDhQy+Rqnqryt0VoezLal\\r\\n# + heiinHzZD/4Y4hZYPf0u8TSv1ZfKtdBweWG3QU0Lp/I9SbIoemDG97RULMcPvq2u\\r\\n# fhUp3OMiYQGL1WqkykSnqRJsM2IcA4l4dmoPNP6dLg5Dr7NVoYKIMInaQVZjSwDM\\r\\n# + ZhWryvfizX0SrzyLgkMPhLMVkfLxQQSQ37NeFk7F1RfeAkNWAh6mCORBMIIGcTCC\\r\\n# BFmgAwIBAgIKYQmBKgAAAAAAAjANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMC\\r\\n# + VVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNV\\r\\n# BAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJv\\r\\n# + b3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzAxMjEzNjU1WhcN\\r\\n# MjUwNzAxMjE0NjU1WjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3Rv\\r\\n# + bjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0\\r\\n# aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDCCASIw\\r\\n# + DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKkdDbx3EYo6IOz8E5f1+n9plGt0\\r\\n# VBDVpQoAgoX77XxoSyxfxcPlYcJ2tz5mK1vwFVMnBDEfQRsalR3OCROOfGEwWbEw\\r\\n# + RA/xYIiEVEMM1024OAizQt2TrNZzMFcmgqNFDdDq9UeBzb8kYDJYYEbyWEeGMoQe\\r\\n# dGFnkV+BVLHPk0ySwcSmXdFhE24oxhr5hoC732H8RsEnHSRnEnIaIYqvS2SJUGKx\\r\\n# + Xf13Hz3wV3WsvYpCTUBR0Q+cBj5nf/VmwAOWRH7v0Ev9buWayrGo8noqCjHw2k4G\\r\\n# kbaICDXoeByw6ZnNPOcvRLqn9NxkvaQBwSAJk3jN/LzAyURdXhacAQVPIk0CAwEA\\r\\n# + AaOCAeYwggHiMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTVYzpcijGQ80N7\\r\\n# fEYbxTNoWoVtVTAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMC\\r\\n# + AYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvX\\r\\n# zpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20v\\r\\n# + cGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYI\\r\\n# KwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j\\r\\n# + b20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBoAYDVR0g\\r\\n# AQH/BIGVMIGSMIGPBgkrBgEEAYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93\\r\\n# + d3cubWljcm9zb2Z0LmNvbS9QS0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYB\\r\\n# BQUHAgIwNB4yIB0ATABlAGcAYQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUA\\r\\n# + bQBlAG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAAfmiFEN4sbgmD+BcQM9naOh\\r\\n# IW+z66bM9TG+zwXiqf76V20ZMLPCxWbJat/15/B4vceoniXj+bzta1RXCCtRgkQS\\r\\n# + +7lTjMz0YBKKdsxAQEGb3FwX/1z5Xhc1mCRWS3TvQhDIr79/xn/yN31aPxzymXlK\\r\\n# kVIArzgPF/UveYFl2am1a+THzvbKegBvSzBEJCI8z+0DpZaPWSm8tv0E4XCfMkon\\r\\n# + /VWvL/625Y4zu2JfmttXQOnxzplmkIz/amJ/3cVKC5Em4jnsGUpxY517IW3DnKOi\\r\\n# PPp/fZZqkHimbdLhnPkd/DjYlPTGpQqWhqS9nhquBEKDuLWAmyI4ILUl5WTs9/S/\\r\\n# + fmNZJQ96LjlXdqJxqgaKD4kWumGnEcua2A5HmoDF0M2n0O99g/DhO3EJ3110mCII\\r\\n# YdqwUB5vvfHhAN/nMQekkzr3ZUd46PioSKv33nJ+YWtvd6mBy6cJrDm77MbL2IK0\\r\\n# + cs0d9LiFAR6A+xuJKlQ5slvayA1VmXqHczsI5pgt6o3gMy4SKfXAL1QnIffIrE7a\\r\\n# KLixqduWsqdCosnPGUFN4Ib5KpqjEWYw07t0MkvfY3v1mYovG8chr1m1rtxEPJdQ\\r\\n# + cdeh0sVV42neV8HR3jDA/czmTfsNv11P6Z0eGTgvvM9YBS7vDaBQNdrvCScc1bN+\\r\\n# NR4Iuto229Nfj950iEkSoYIC0jCCAjsCAQEwgfyhgdSkgdEwgc4xCzAJBgNVBAYT\\r\\n# + AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYD\\r\\n# VQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBP\\r\\n# + cGVyYXRpb25zIFB1ZXJ0byBSaWNvMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjoz\\r\\n# MkJELUUzRDUtM0IxRDElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2Vy\\r\\n# + dmljZaIjCgEBMAcGBSsOAwIaAxUAmrP6Chrbz0ax7s57n5Pop3VC8gyggYMwgYCk\\r\\n# fjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH\\r\\n# + UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQD\\r\\n# Ex1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDANBgkqhkiG9w0BAQUFAAIF\\r\\n# + AOVl6eEwIhgPMjAyMTEyMTYyMDM3NTNaGA8yMDIxMTIxNzIwMzc1M1owdzA9Bgor\\r\\n# BgEEAYRZCgQBMS8wLTAKAgUA5WXp4QIBADAKAgEAAgImLQIB/zAHAgEAAgIRZTAK\\r\\n# + AgUA5Wc7YQIBADA2BgorBgEEAYRZCgQCMSgwJjAMBgorBgEEAYRZCgMCoAowCAIB\\r\\n# AAIDB6EgoQowCAIBAAIDAYagMA0GCSqGSIb3DQEBBQUAA4GBAC4p22W/BTLU59AZ\\r\\n# + mq7J4ncxRFzBDZCAKzh7dR8p0QxHUnzjLOEel93u4HWY6Tt/2A8TUH4Et1L1xFF9\\r\\n# FknQP5OdDkyG6yVSTCb0mVNLSvlnJTJv+uzQjUnuCiMiLNVzdurDix9a6ZIZGTBM\\r\\n# + CecyoXxKddh5DLdaHoKB9AXutk9KMYIDDTCCAwkCAQEwgZMwfDELMAkGA1UEBhMC\\r\\n# VVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNV\\r\\n# + BAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRp\\r\\n# bWUtU3RhbXAgUENBIDIwMTACEzMAAAFi0P4C8wHlzUkAAAAAAWIwDQYJYIZIAWUD\\r\\n# + BAIBBQCgggFKMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAvBgkqhkiG9w0B\\r\\n# CQQxIgQguv8GxZGcH4TXT9NV2V7H38GI4dgHpEL2X/CSiTbri/wwgfoGCyqGSIb3\\r\\n# + DQEJEAIvMYHqMIHnMIHkMIG9BCCKqhiV+zwNDrpU7DRB7Mi57xi6GBNYsGjgZqq2\\r\\n# qVMKMjCBmDCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9u\\r\\n# + MRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRp\\r\\n# b24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAAB\\r\\n# + YtD+AvMB5c1JAAAAAAFiMCIEINUvEHIP1Fm2iR/LS7L05Ee6SjVXxQjYlcPAI+ZX\\r\\n# nyG1MA0GCSqGSIb3DQEBCwUABIIBADLt6mIx65VVMuXtjDNZc2xTuq6IrGzP0KBe\\r\\n# + djjNBE1r1bzROrszoYTuu8c9bRJR0pAxmfWeymA1SWJH4FlByE06scvOHSptBQBC\\r\\n# zKVmAVjbbp2DyiyGXavtpK6W4wrDaozFK8GU1K/EDAEmkSQ+fVMrKsTU2IuL+SBc\\r\\n# + +UDolgP9oUb/TGSzwu6WrY4WRBzqzNYdyUtyq1MdttUvU7cpB60MWWYkH0c7DJIr\\r\\n# UyY1QvywMLxobj2f1SPpBRlmyn0BEbdj2tYMQPFyivt309tXaDDkHeFTYiezv2N2\\r\\n# + sKtDrgJzMz1kPq2d9IIKQznVvggwWMfUQNMNs6Ai/DDXrmI8gVE=\\r\\n# SIG # End signature + block\\r\\n\"\r\n ],\r\n \"parameters\": [\r\n {\r\n \"name\": \"arg1\",\r\n + \ \"type\": \"string\",\r\n \"required\": false\r\n },\r\n {\r\n + \ \"name\": \"arg2\",\r\n \"type\": \"string\",\r\n \"required\": + false\r\n }\r\n ],\r\n \"$schema\": \"http://schema.management.azure.com/schemas/2016-11-17/runcommands.json\",\r\n \ \"id\": \"RunPowerShellScript\",\r\n \"osType\": \"Windows\",\r\n \"label\": \"Executes a PowerShell script\",\r\n \"description\": \"Custom multiline PowerShell script should be defined in script property. Optional parameters @@ -1364,11 +1458,11 @@ interactions: cache-control: - no-cache content-length: - - '14029' + - '14045' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:29 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' pragma: @@ -1399,7 +1493,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions?api-version=2021-07-01 @@ -1420,7 +1514,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:29 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' pragma: @@ -1437,7 +1531,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3919,Microsoft.Compute/LowCostGet30Min;31515 + - Microsoft.Compute/LowCostGet3Min;3990,Microsoft.Compute/LowCostGet30Min;31988 status: code: 200 message: OK @@ -1451,7 +1545,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff?api-version=2021-07-01 @@ -1459,28 +1553,28 @@ interactions: body: string: "{\r\n \"name\": \"virtualmachinex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff\",\r\n \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n - \ \"properties\": {\r\n \"vmId\": \"cb618dc1-c323-4478-acda-f534a5b3d94d\",\r\n + \ \"properties\": {\r\n \"vmId\": \"8251ae64-33be-417e-8b12-e616eaf72145\",\r\n \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_D2_v2\"\r\n },\r\n \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": \"Windows\",\r\n \"name\": \"myVMosdisk\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/myVMosdisk\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 127\r\n },\r\n \"dataDisks\": [\r\n {\r\n \"lun\": - 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\",\r\n + 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n },\r\n {\r\n - \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\",\r\n + \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n }\r\n ]\r\n },\r\n \ \"osProfile\": {\r\n \"computerName\": \"myVM\",\r\n \"adminUsername\": @@ -1506,7 +1600,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:29 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' pragma: @@ -1523,7 +1617,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3918,Microsoft.Compute/LowCostGet30Min;31514 + - Microsoft.Compute/LowCostGet3Min;3989,Microsoft.Compute/LowCostGet30Min;31987 status: code: 200 message: OK @@ -1541,7 +1635,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/runCommand?api-version=2021-07-01 @@ -1550,17 +1644,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/81b33448-9684-4858-9cb9-aca96048f7b9?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ed7323c6-4960-47af-9fa2-41544954c29b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:58:29 GMT + - Thu, 06 Jan 2022 07:55:05 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/81b33448-9684-4858-9cb9-aca96048f7b9?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ed7323c6-4960-47af-9fa2-41544954c29b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1573,7 +1667,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/UpdateVM3Min;238,Microsoft.Compute/UpdateVM30Min;1198 x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 202 message: Accepted @@ -1587,23 +1681,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/81b33448-9684-4858-9cb9-aca96048f7b9?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ed7323c6-4960-47af-9fa2-41544954c29b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:58:29.5859685+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"81b33448-9684-4858-9cb9-aca96048f7b9\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:55:05.802742+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"ed7323c6-4960-47af-9fa2-41544954c29b\"\r\n}" headers: cache-control: - no-cache content-length: - - '134' + - '133' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:58:59 GMT + - Thu, 06 Jan 2022 07:55:35 GMT expires: - '-1' pragma: @@ -1620,7 +1714,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29896 + - Microsoft.Compute/GetOperation3Min;14991,Microsoft.Compute/GetOperation30Min;29986 status: code: 200 message: OK @@ -1634,26 +1728,26 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/81b33448-9684-4858-9cb9-aca96048f7b9?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ed7323c6-4960-47af-9fa2-41544954c29b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:58:29.5859685+00:00\",\r\n \"endTime\": - \"2021-10-12T06:58:59.9454725+00:00\",\r\n \"status\": \"Succeeded\",\r\n + string: "{\r\n \"startTime\": \"2022-01-06T07:55:05.802742+00:00\",\r\n \"endTime\": + \"2022-01-06T07:55:36.1778087+00:00\",\r\n \"status\": \"Succeeded\",\r\n \ \"properties\": {\r\n \"output\": {\"value\":[{\"code\":\"ComponentStatus/StdOut/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning succeeded\",\"message\":\"This is a sample script with parameters \"},{\"code\":\"ComponentStatus/StdErr/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning - succeeded\",\"message\":\"\"}]}\r\n },\r\n \"name\": \"81b33448-9684-4858-9cb9-aca96048f7b9\"\r\n}" + succeeded\",\"message\":\"\"}]}\r\n },\r\n \"name\": \"ed7323c6-4960-47af-9fa2-41544954c29b\"\r\n}" headers: cache-control: - no-cache content-length: - - '503' + - '502' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:59:29 GMT + - Thu, 06 Jan 2022 07:56:05 GMT expires: - '-1' pragma: @@ -1670,7 +1764,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29894 + - Microsoft.Compute/GetOperation3Min;14990,Microsoft.Compute/GetOperation30Min;29984 status: code: 200 message: OK @@ -1684,10 +1778,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/81b33448-9684-4858-9cb9-aca96048f7b9?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ed7323c6-4960-47af-9fa2-41544954c29b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '{"value":[{"code":"ComponentStatus/StdOut/succeeded","level":"Info","displayStatus":"Provisioning @@ -1701,7 +1795,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 06:59:29 GMT + - Thu, 06 Jan 2022 07:56:05 GMT expires: - '-1' pragma: @@ -1718,7 +1812,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29893 + - Microsoft.Compute/GetOperation3Min;14989,Microsoft.Compute/GetOperation30Min;29983 status: code: 200 message: OK @@ -1734,7 +1828,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/restart?api-version=2021-07-01 @@ -1743,17 +1837,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ecbd4849-4e64-42fb-86cc-0e072b1f4e74?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7e78f9f8-4e96-4c1a-b0ec-442cbd6e946c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 06:59:29 GMT + - Thu, 06 Jan 2022 07:56:06 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ecbd4849-4e64-42fb-86cc-0e072b1f4e74?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7e78f9f8-4e96-4c1a-b0ec-442cbd6e946c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1766,7 +1860,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/UpdateVM3Min;238,Microsoft.Compute/UpdateVM30Min;1197 x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1196' status: code: 202 message: Accepted @@ -1780,24 +1874,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ecbd4849-4e64-42fb-86cc-0e072b1f4e74?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7e78f9f8-4e96-4c1a-b0ec-442cbd6e946c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T06:59:30.2894158+00:00\",\r\n \"endTime\": - \"2021-10-12T06:59:30.633146+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"ecbd4849-4e64-42fb-86cc-0e072b1f4e74\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:56:06.2403338+00:00\",\r\n \"endTime\": + \"2022-01-06T07:56:06.5059334+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"7e78f9f8-4e96-4c1a-b0ec-442cbd6e946c\"\r\n}" headers: cache-control: - no-cache content-length: - - '183' + - '184' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:00:00 GMT + - Thu, 06 Jan 2022 07:56:35 GMT expires: - '-1' pragma: @@ -1814,7 +1908,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29910 + - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29981 status: code: 200 message: OK @@ -1828,10 +1922,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/ecbd4849-4e64-42fb-86cc-0e072b1f4e74?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7e78f9f8-4e96-4c1a-b0ec-442cbd6e946c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1841,7 +1935,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:00:00 GMT + - Thu, 06 Jan 2022 07:56:35 GMT expires: - '-1' pragma: @@ -1854,7 +1948,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29909 + - Microsoft.Compute/GetOperation3Min;14987,Microsoft.Compute/GetOperation30Min;29980 status: code: 200 message: OK @@ -1870,7 +1964,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/powerOff?skipShutdown=false&api-version=2021-07-01 @@ -1879,17 +1973,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/728e0298-1263-40f4-b54a-02ebaf6902d6?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/42c4abea-337e-4587-89c9-fe5dd660f88b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:00:00 GMT + - Thu, 06 Jan 2022 07:56:35 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/728e0298-1263-40f4-b54a-02ebaf6902d6?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/42c4abea-337e-4587-89c9-fe5dd660f88b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1902,7 +1996,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/UpdateVM3Min;237,Microsoft.Compute/UpdateVM30Min;1196 x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1195' status: code: 202 message: Accepted @@ -1916,15 +2010,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/728e0298-1263-40f4-b54a-02ebaf6902d6?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/42c4abea-337e-4587-89c9-fe5dd660f88b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:00:00.9144018+00:00\",\r\n \"endTime\": - \"2021-10-12T07:00:13.3983981+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"728e0298-1263-40f4-b54a-02ebaf6902d6\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:56:36.4591415+00:00\",\r\n \"endTime\": + \"2022-01-06T07:56:36.6622438+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"42c4abea-337e-4587-89c9-fe5dd660f88b\"\r\n}" headers: cache-control: - no-cache @@ -1933,7 +2027,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:00:30 GMT + - Thu, 06 Jan 2022 07:57:06 GMT expires: - '-1' pragma: @@ -1950,7 +2044,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14979,Microsoft.Compute/GetOperation30Min;29903 + - Microsoft.Compute/GetOperation3Min;14986,Microsoft.Compute/GetOperation30Min;29978 status: code: 200 message: OK @@ -1964,10 +2058,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/728e0298-1263-40f4-b54a-02ebaf6902d6?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/42c4abea-337e-4587-89c9-fe5dd660f88b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1977,7 +2071,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:00:30 GMT + - Thu, 06 Jan 2022 07:57:06 GMT expires: - '-1' pragma: @@ -1990,7 +2084,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14978,Microsoft.Compute/GetOperation30Min;29902 + - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29977 status: code: 200 message: OK @@ -2006,7 +2100,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/start?api-version=2021-07-01 @@ -2015,17 +2109,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8cd35c8c-27e1-4687-96ec-e368626c2027?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1fb1dccb-5c5b-415c-bc25-9e44273bd912?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:00:30 GMT + - Thu, 06 Jan 2022 07:57:06 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8cd35c8c-27e1-4687-96ec-e368626c2027?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1fb1dccb-5c5b-415c-bc25-9e44273bd912?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2038,7 +2132,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/UpdateVM3Min;236,Microsoft.Compute/UpdateVM30Min;1195 x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1194' status: code: 202 message: Accepted @@ -2052,24 +2146,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8cd35c8c-27e1-4687-96ec-e368626c2027?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1fb1dccb-5c5b-415c-bc25-9e44273bd912?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:00:31.4767483+00:00\",\r\n \"endTime\": - \"2021-10-12T07:00:39.6800283+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"8cd35c8c-27e1-4687-96ec-e368626c2027\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:57:06.7873326+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"1fb1dccb-5c5b-415c-bc25-9e44273bd912\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:00:40 GMT + - Thu, 06 Jan 2022 07:57:16 GMT expires: - '-1' pragma: @@ -2086,7 +2179,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14977,Microsoft.Compute/GetOperation30Min;29901 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29976 status: code: 200 message: OK @@ -2100,20 +2193,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8cd35c8c-27e1-4687-96ec-e368626c2027?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1fb1dccb-5c5b-415c-bc25-9e44273bd912?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: '' + string: "{\r\n \"startTime\": \"2022-01-06T07:57:06.7873326+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"1fb1dccb-5c5b-415c-bc25-9e44273bd912\"\r\n}" headers: cache-control: - no-cache content-length: - - '0' + - '134' + content-type: + - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:00:40 GMT + - Thu, 06 Jan 2022 07:57:25 GMT expires: - '-1' pragma: @@ -2123,53 +2219,44 @@ interactions: - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14976,Microsoft.Compute/GetOperation30Min;29900 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29974 status: code: 200 message: OK - request: - body: '{"properties": {"autoUpgradeMinorVersion": true}}' + body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate Connection: - keep-alive - Content-Length: - - '49' - Content-Type: - - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 - method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1fb1dccb-5c5b-415c-bc25-9e44273bd912?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"name\": \"virtualmachineextensionx15cf0eff\",\r\n \"id\": - \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff\",\r\n - \ \"type\": \"Microsoft.Compute/virtualMachines/extensions\",\r\n \"location\": - \"eastus\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n - \ \"provisioningState\": \"Updating\",\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\",\r\n - \ \"type\": \"NetworkWatcherAgentWindows\",\r\n \"typeHandlerVersion\": - \"1.4\"\r\n }\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:57:06.7873326+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"1fb1dccb-5c5b-415c-bc25-9e44273bd912\"\r\n}" headers: - azure-asyncnotification: - - Enabled - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/e917dfaa-455f-4a2c-a5a8-86fdafa820f0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - - '635' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:00:41 GMT + - Thu, 06 Jan 2022 07:57:55 GMT expires: - '-1' pragma: @@ -2186,9 +2273,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/UpdateVM3Min;235,Microsoft.Compute/UpdateVM30Min;1194 - x-ms-ratelimit-remaining-subscription-writes: - - '1194' + - Microsoft.Compute/GetOperation3Min;14981,Microsoft.Compute/GetOperation30Min;29971 status: code: 200 message: OK @@ -2202,15 +2287,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/e917dfaa-455f-4a2c-a5a8-86fdafa820f0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1fb1dccb-5c5b-415c-bc25-9e44273bd912?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:00:42.0238121+00:00\",\r\n \"endTime\": - \"2021-10-12T07:00:42.3363612+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"e917dfaa-455f-4a2c-a5a8-86fdafa820f0\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:57:06.7873326+00:00\",\r\n \"endTime\": + \"2022-01-06T07:58:02.1467077+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"1fb1dccb-5c5b-415c-bc25-9e44273bd912\"\r\n}" headers: cache-control: - no-cache @@ -2219,7 +2304,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:01:12 GMT + - Thu, 06 Jan 2022 07:58:25 GMT expires: - '-1' pragma: @@ -2236,7 +2321,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14975,Microsoft.Compute/GetOperation30Min;29895 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29969 status: code: 200 message: OK @@ -2250,28 +2335,20 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1fb1dccb-5c5b-415c-bc25-9e44273bd912?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: - string: "{\r\n \"name\": \"virtualmachineextensionx15cf0eff\",\r\n \"id\": - \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff\",\r\n - \ \"type\": \"Microsoft.Compute/virtualMachines/extensions\",\r\n \"location\": - \"eastus\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n - \ \"provisioningState\": \"Succeeded\",\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\",\r\n - \ \"type\": \"NetworkWatcherAgentWindows\",\r\n \"typeHandlerVersion\": - \"1.4\"\r\n }\r\n}" + string: '' headers: cache-control: - no-cache content-length: - - '636' - content-type: - - application/json; charset=utf-8 + - '0' date: - - Tue, 12 Oct 2021 07:01:12 GMT + - Thu, 06 Jan 2022 07:58:25 GMT expires: - '-1' pragma: @@ -2281,51 +2358,55 @@ interactions: - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3915,Microsoft.Compute/LowCostGet30Min;31538 + - Microsoft.Compute/GetOperation3Min;14981,Microsoft.Compute/GetOperation30Min;29968 status: code: 200 message: OK - request: - body: null + body: '{"properties": {"autoUpgradeMinorVersion": true}}' headers: Accept: - - '*/*' + - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive Content-Length: - - '0' + - '49' + Content-Type: + - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 - method: DELETE + method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 response: body: - string: '' + string: "{\r\n \"name\": \"virtualmachineextensionx15cf0eff\",\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff\",\r\n + \ \"type\": \"Microsoft.Compute/virtualMachines/extensions\",\r\n \"location\": + \"eastus\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n + \ \"provisioningState\": \"Updating\",\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\",\r\n + \ \"type\": \"NetworkWatcherAgentWindows\",\r\n \"typeHandlerVersion\": + \"1.4\"\r\n }\r\n}" headers: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/591ae64f-17c9-479c-8749-f4c2c50b6991?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/59b36e58-9bf7-4551-9fa2-ed832f393ad2?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - - '0' + - '635' + content-type: + - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:01:12 GMT + - Thu, 06 Jan 2022 07:58:25 GMT expires: - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/591ae64f-17c9-479c-8749-f4c2c50b6991?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2333,15 +2414,19 @@ interactions: - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/UpdateVM3Min;235,Microsoft.Compute/UpdateVM30Min;1193 - x-ms-ratelimit-remaining-subscription-deletes: - - '14994' + - Microsoft.Compute/UpdateVM3Min;236,Microsoft.Compute/UpdateVM30Min;1194 + x-ms-ratelimit-remaining-subscription-writes: + - '1195' status: - code: 202 - message: Accepted + code: 200 + message: OK - request: body: null headers: @@ -2352,23 +2437,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/591ae64f-17c9-479c-8749-f4c2c50b6991?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/59b36e58-9bf7-4551-9fa2-ed832f393ad2?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:01:12.7271473+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"591ae64f-17c9-479c-8749-f4c2c50b6991\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:58:26.177943+00:00\",\r\n \"endTime\": + \"2022-01-06T07:58:26.4903875+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"59b36e58-9bf7-4551-9fa2-ed832f393ad2\"\r\n}" headers: cache-control: - no-cache content-length: - - '134' + - '183' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:01:42 GMT + - Thu, 06 Jan 2022 07:58:56 GMT expires: - '-1' pragma: @@ -2385,7 +2471,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14973,Microsoft.Compute/GetOperation30Min;29890 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29967 status: code: 200 message: OK @@ -2399,24 +2485,28 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/591ae64f-17c9-479c-8749-f4c2c50b6991?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:01:12.7271473+00:00\",\r\n \"endTime\": - \"2021-10-12T07:01:53.0084064+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"591ae64f-17c9-479c-8749-f4c2c50b6991\"\r\n}" + string: "{\r\n \"name\": \"virtualmachineextensionx15cf0eff\",\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff\",\r\n + \ \"type\": \"Microsoft.Compute/virtualMachines/extensions\",\r\n \"location\": + \"eastus\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n + \ \"provisioningState\": \"Succeeded\",\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\",\r\n + \ \"type\": \"NetworkWatcherAgentWindows\",\r\n \"typeHandlerVersion\": + \"1.4\"\r\n }\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '636' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:02:12 GMT + - Thu, 06 Jan 2022 07:58:56 GMT expires: - '-1' pragma: @@ -2433,7 +2523,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14969,Microsoft.Compute/GetOperation30Min;29884 + - Microsoft.Compute/LowCostGet3Min;3996,Microsoft.Compute/LowCostGet30Min;31984 status: code: 200 message: OK @@ -2449,26 +2539,28 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/powerOff?skipShutdown=false&api-version=2021-07-01 + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/extensions/virtualmachineextensionx15cf0eff?api-version=2021-07-01 response: body: string: '' headers: + azure-asyncnotification: + - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/284ee46a-95fc-4b79-b91f-b087e52b4761?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/aa58636b-a005-4a33-9473-5472830ac4cd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:02:12 GMT + - Thu, 06 Jan 2022 07:58:56 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/284ee46a-95fc-4b79-b91f-b087e52b4761?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/aa58636b-a005-4a33-9473-5472830ac4cd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2479,9 +2571,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/UpdateVM3Min;234,Microsoft.Compute/UpdateVM30Min;1192 - x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - Microsoft.Compute/UpdateVM3Min;235,Microsoft.Compute/UpdateVM30Min;1193 + x-ms-ratelimit-remaining-subscription-deletes: + - '14996' status: code: 202 message: Accepted @@ -2495,24 +2587,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/284ee46a-95fc-4b79-b91f-b087e52b4761?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/aa58636b-a005-4a33-9473-5472830ac4cd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:02:13.1959528+00:00\",\r\n \"endTime\": - \"2021-10-12T07:02:29.2273076+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"284ee46a-95fc-4b79-b91f-b087e52b4761\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:58:56.6779024+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"aa58636b-a005-4a33-9473-5472830ac4cd\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:02:43 GMT + - Thu, 06 Jan 2022 07:59:26 GMT expires: - '-1' pragma: @@ -2529,7 +2620,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14968,Microsoft.Compute/GetOperation30Min;29879 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29966 status: code: 200 message: OK @@ -2543,20 +2634,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/284ee46a-95fc-4b79-b91f-b087e52b4761?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/aa58636b-a005-4a33-9473-5472830ac4cd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: '' + string: "{\r\n \"startTime\": \"2022-01-06T07:58:56.6779024+00:00\",\r\n \"endTime\": + \"2022-01-06T07:59:26.9435642+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"aa58636b-a005-4a33-9473-5472830ac4cd\"\r\n}" headers: cache-control: - no-cache content-length: - - '0' + - '184' + content-type: + - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:02:43 GMT + - Thu, 06 Jan 2022 07:59:56 GMT expires: - '-1' pragma: @@ -2566,10 +2661,14 @@ interactions: - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14967,Microsoft.Compute/GetOperation30Min;29878 + - Microsoft.Compute/GetOperation3Min;14986,Microsoft.Compute/GetOperation30Min;29965 status: code: 200 message: OK @@ -2577,7 +2676,7 @@ interactions: body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate Connection: @@ -2585,26 +2684,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/reapply?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/powerOff?skipShutdown=false&api-version=2021-07-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/69281ca1-24da-4364-ac98-c59485d2a643?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/4a5d9067-566d-43f6-b300-a4f88135482c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:02:43 GMT + - Thu, 06 Jan 2022 07:59:56 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/69281ca1-24da-4364-ac98-c59485d2a643?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/4a5d9067-566d-43f6-b300-a4f88135482c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2615,9 +2714,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/UpdateVM3Min;234,Microsoft.Compute/UpdateVM30Min;1191 + - Microsoft.Compute/UpdateVM3Min;236,Microsoft.Compute/UpdateVM30Min;1192 x-ms-ratelimit-remaining-subscription-writes: - - '1194' + - '1193' status: code: 202 message: Accepted @@ -2631,24 +2730,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/69281ca1-24da-4364-ac98-c59485d2a643?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/4a5d9067-566d-43f6-b300-a4f88135482c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:02:43.63361+00:00\",\r\n \"endTime\": - \"2021-10-12T07:02:45.2273619+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"69281ca1-24da-4364-ac98-c59485d2a643\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T07:59:56.8966995+00:00\",\r\n \"endTime\": + \"2022-01-06T08:00:07.0842089+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"4a5d9067-566d-43f6-b300-a4f88135482c\"\r\n}" headers: cache-control: - no-cache content-length: - - '182' + - '184' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:03:13 GMT + - Thu, 06 Jan 2022 08:00:26 GMT expires: - '-1' pragma: @@ -2665,7 +2764,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14968,Microsoft.Compute/GetOperation30Min;29872 + - Microsoft.Compute/GetOperation3Min;14989,Microsoft.Compute/GetOperation30Min;29963 status: code: 200 message: OK @@ -2679,10 +2778,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/69281ca1-24da-4364-ac98-c59485d2a643?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/4a5d9067-566d-43f6-b300-a4f88135482c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -2692,7 +2791,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:03:13 GMT + - Thu, 06 Jan 2022 08:00:26 GMT expires: - '-1' pragma: @@ -2705,7 +2804,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14967,Microsoft.Compute/GetOperation30Min;29871 + - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29962 status: code: 200 message: OK @@ -2713,7 +2812,7 @@ interactions: body: null headers: Accept: - - '*/*' + - application/json Accept-Encoding: - gzip, deflate Connection: @@ -2721,26 +2820,26 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/redeploy?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/reapply?api-version=2021-07-01 response: body: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/cbcf31aa-97d4-4678-960c-0da5c7838a00?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/66ecc910-639b-41aa-ba59-9a739cf362d0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:03:13 GMT + - Thu, 06 Jan 2022 08:00:26 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/cbcf31aa-97d4-4678-960c-0da5c7838a00?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/66ecc910-639b-41aa-ba59-9a739cf362d0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2751,9 +2850,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/UpdateVM3Min;234,Microsoft.Compute/UpdateVM30Min;1190 + - Microsoft.Compute/UpdateVM3Min;236,Microsoft.Compute/UpdateVM30Min;1191 x-ms-ratelimit-remaining-subscription-writes: - - '1193' + - '1192' status: code: 202 message: Accepted @@ -2767,23 +2866,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/cbcf31aa-97d4-4678-960c-0da5c7838a00?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/66ecc910-639b-41aa-ba59-9a739cf362d0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:03:14.1025568+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"cbcf31aa-97d4-4678-960c-0da5c7838a00\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:00:27.1310977+00:00\",\r\n \"endTime\": + \"2022-01-06T08:00:28.365451+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"66ecc910-639b-41aa-ba59-9a739cf362d0\"\r\n}" headers: cache-control: - no-cache content-length: - - '134' + - '183' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:03:43 GMT + - Thu, 06 Jan 2022 08:00:57 GMT expires: - '-1' pragma: @@ -2800,7 +2900,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14972,Microsoft.Compute/GetOperation30Min;29869 + - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29959 status: code: 200 message: OK @@ -2814,23 +2914,20 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/cbcf31aa-97d4-4678-960c-0da5c7838a00?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/66ecc910-639b-41aa-ba59-9a739cf362d0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:03:14.1025568+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"cbcf31aa-97d4-4678-960c-0da5c7838a00\"\r\n}" + string: '' headers: cache-control: - no-cache content-length: - - '134' - content-type: - - application/json; charset=utf-8 + - '0' date: - - Tue, 12 Oct 2021 07:04:13 GMT + - Thu, 06 Jan 2022 08:00:57 GMT expires: - '-1' pragma: @@ -2840,14 +2937,10 @@ interactions: - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14972,Microsoft.Compute/GetOperation30Min;29866 + - Microsoft.Compute/GetOperation3Min;14987,Microsoft.Compute/GetOperation30Min;29958 status: code: 200 message: OK @@ -2860,26 +2953,29 @@ interactions: - gzip, deflate Connection: - keep-alive + Content-Length: + - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/cbcf31aa-97d4-4678-960c-0da5c7838a00?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/redeploy?api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:03:14.1025568+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"cbcf31aa-97d4-4678-960c-0da5c7838a00\"\r\n}" + string: '' headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f960351-e2b2-457d-b059-ec392e310918?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - - '134' - content-type: - - application/json; charset=utf-8 + - '0' date: - - Tue, 12 Oct 2021 07:04:45 GMT + - Thu, 06 Jan 2022 08:00:57 GMT expires: - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f960351-e2b2-457d-b059-ec392e310918?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2887,17 +2983,15 @@ interactions: - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14978,Microsoft.Compute/GetOperation30Min;29863 + - Microsoft.Compute/UpdateVM3Min;235,Microsoft.Compute/UpdateVM30Min;1190 + x-ms-ratelimit-remaining-subscription-writes: + - '1191' status: - code: 200 - message: OK + code: 202 + message: Accepted - request: body: null headers: @@ -2908,15 +3002,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/cbcf31aa-97d4-4678-960c-0da5c7838a00?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f960351-e2b2-457d-b059-ec392e310918?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:03:14.1025568+00:00\",\r\n \"endTime\": - \"2021-10-12T07:04:59.5563137+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"cbcf31aa-97d4-4678-960c-0da5c7838a00\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:00:57.3499243+00:00\",\r\n \"endTime\": + \"2022-01-06T08:01:18.5843289+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"8f960351-e2b2-457d-b059-ec392e310918\"\r\n}" headers: cache-control: - no-cache @@ -2925,7 +3019,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:05:14 GMT + - Thu, 06 Jan 2022 08:01:27 GMT expires: - '-1' pragma: @@ -2942,7 +3036,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14979,Microsoft.Compute/GetOperation30Min;29896 + - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29956 status: code: 200 message: OK @@ -2956,10 +3050,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/cbcf31aa-97d4-4678-960c-0da5c7838a00?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8f960351-e2b2-457d-b059-ec392e310918?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -2969,7 +3063,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:05:15 GMT + - Thu, 06 Jan 2022 08:01:27 GMT expires: - '-1' pragma: @@ -2982,7 +3076,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14978,Microsoft.Compute/GetOperation30Min;29895 + - Microsoft.Compute/GetOperation3Min;14987,Microsoft.Compute/GetOperation30Min;29955 status: code: 200 message: OK @@ -3001,7 +3095,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff?api-version=2021-07-01 @@ -3009,28 +3103,28 @@ interactions: body: string: "{\r\n \"name\": \"virtualmachinex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff\",\r\n \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n - \ \"properties\": {\r\n \"vmId\": \"cb618dc1-c323-4478-acda-f534a5b3d94d\",\r\n + \ \"properties\": {\r\n \"vmId\": \"8251ae64-33be-417e-8b12-e616eaf72145\",\r\n \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_D2_v2\"\r\n },\r\n \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": \"Windows\",\r\n \"name\": \"myVMosdisk\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/myVMosdisk\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 127\r\n },\r\n \"dataDisks\": [\r\n {\r\n \"lun\": - 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\",\r\n + 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n },\r\n {\r\n - \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\",\r\n + \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n }\r\n ]\r\n },\r\n \ \"osProfile\": {\r\n \"computerName\": \"myVM\",\r\n \"adminUsername\": @@ -3049,7 +3143,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:05:16 GMT + - Thu, 06 Jan 2022 08:01:27 GMT expires: - '-1' pragma: @@ -3066,9 +3160,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutVM3Min;744,Microsoft.Compute/PutVM30Min;3714 + - Microsoft.Compute/PutVM3Min;744,Microsoft.Compute/PutVM30Min;3727 x-ms-ratelimit-remaining-subscription-writes: - - '1193' + - '1194' status: code: 200 message: OK @@ -3082,7 +3176,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff?api-version=2021-07-01 @@ -3090,28 +3184,28 @@ interactions: body: string: "{\r\n \"name\": \"virtualmachinex15cf0eff\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff\",\r\n \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n - \ \"properties\": {\r\n \"vmId\": \"cb618dc1-c323-4478-acda-f534a5b3d94d\",\r\n + \ \"properties\": {\r\n \"vmId\": \"8251ae64-33be-417e-8b12-e616eaf72145\",\r\n \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_D2_v2\"\r\n },\r\n \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": \"Windows\",\r\n \"name\": \"myVMosdisk\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/myVMosdisk\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 127\r\n },\r\n \"dataDisks\": [\r\n {\r\n \"lun\": - 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\",\r\n + 0,\r\n \"name\": \"virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_4d06b30d95434874803da0dece4144b9\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk2_edff795946054a4fae68e5bf72ccc4d4\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n },\r\n {\r\n - \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\",\r\n + \ \"lun\": 1,\r\n \"name\": \"virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\",\r\n \ \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_54f5bbb287db4c28a1a9cd9576d12333\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinex15cf0eff_disk3_92f685f4d9fd433ea51fd1ca76818ee8\"\r\n \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": 1023,\r\n \"toBeDetached\": false\r\n }\r\n ]\r\n },\r\n \ \"osProfile\": {\r\n \"computerName\": \"myVM\",\r\n \"adminUsername\": @@ -3130,7 +3224,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:05:47 GMT + - Thu, 06 Jan 2022 08:01:57 GMT expires: - '-1' pragma: @@ -3147,7 +3241,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3976,Microsoft.Compute/LowCostGet30Min;31533 + - Microsoft.Compute/LowCostGet3Min;3996,Microsoft.Compute/LowCostGet30Min;31983 status: code: 200 message: OK @@ -3163,7 +3257,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/generalize?api-version=2021-07-01 @@ -3176,7 +3270,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:05:47 GMT + - Thu, 06 Jan 2022 08:01:57 GMT expires: - '-1' pragma: @@ -3189,9 +3283,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/UpdateVM3Min;238,Microsoft.Compute/UpdateVM30Min;1189 + - Microsoft.Compute/UpdateVM3Min;236,Microsoft.Compute/UpdateVM30Min;1189 x-ms-ratelimit-remaining-subscription-writes: - - '1192' + - '1190' status: code: 200 message: OK @@ -3207,7 +3301,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff/deallocate?api-version=2021-07-01 @@ -3216,17 +3310,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c13f043a-33da-4e25-ad02-0102099949a4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5d6a6864-9b6d-4423-ba79-5d35102d1c73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:05:47 GMT + - Thu, 06 Jan 2022 08:01:57 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c13f043a-33da-4e25-ad02-0102099949a4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5d6a6864-9b6d-4423-ba79-5d35102d1c73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -3237,9 +3331,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteVM3Min;239,Microsoft.Compute/DeleteVM30Min;1191 + - Microsoft.Compute/DeleteVM3Min;239,Microsoft.Compute/DeleteVM30Min;1199 x-ms-ratelimit-remaining-subscription-writes: - - '1191' + - '1189' status: code: 202 message: Accepted @@ -3253,14 +3347,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c13f043a-33da-4e25-ad02-0102099949a4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5d6a6864-9b6d-4423-ba79-5d35102d1c73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:05:47.8847402+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"c13f043a-33da-4e25-ad02-0102099949a4\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:01:58.2718513+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"5d6a6864-9b6d-4423-ba79-5d35102d1c73\"\r\n}" headers: cache-control: - no-cache @@ -3269,7 +3363,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:05:57 GMT + - Thu, 06 Jan 2022 08:02:08 GMT expires: - '-1' pragma: @@ -3286,7 +3380,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29894 + - Microsoft.Compute/GetOperation3Min;14987,Microsoft.Compute/GetOperation30Min;29953 status: code: 200 message: OK @@ -3300,15 +3394,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c13f043a-33da-4e25-ad02-0102099949a4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5d6a6864-9b6d-4423-ba79-5d35102d1c73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:05:47.8847402+00:00\",\r\n \"endTime\": - \"2021-10-12T07:06:18.8380038+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"c13f043a-33da-4e25-ad02-0102099949a4\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:01:58.2718513+00:00\",\r\n \"endTime\": + \"2022-01-06T08:02:21.3499729+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"5d6a6864-9b6d-4423-ba79-5d35102d1c73\"\r\n}" headers: cache-control: - no-cache @@ -3317,7 +3411,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:33 GMT + - Thu, 06 Jan 2022 08:02:43 GMT expires: - '-1' pragma: @@ -3334,7 +3428,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14986,Microsoft.Compute/GetOperation30Min;29890 + - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29950 status: code: 200 message: OK @@ -3348,10 +3442,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c13f043a-33da-4e25-ad02-0102099949a4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5d6a6864-9b6d-4423-ba79-5d35102d1c73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -3361,7 +3455,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:06:34 GMT + - Thu, 06 Jan 2022 08:02:43 GMT expires: - '-1' pragma: @@ -3374,7 +3468,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29889 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29949 status: code: 200 message: OK @@ -3390,7 +3484,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/virtualmachinex15cf0eff?api-version=2021-07-01 @@ -3401,17 +3495,17 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/be30cade-7efc-4730-b912-99de846b4ef5?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/55eb0152-2f8b-4dbc-8879-616ac88b7596?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:06:34 GMT + - Thu, 06 Jan 2022 08:02:44 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/be30cade-7efc-4730-b912-99de846b4ef5?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/55eb0152-2f8b-4dbc-8879-616ac88b7596?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -3422,9 +3516,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteVM3Min;238,Microsoft.Compute/DeleteVM30Min;1190 + - Microsoft.Compute/DeleteVM3Min;238,Microsoft.Compute/DeleteVM30Min;1198 x-ms-ratelimit-remaining-subscription-deletes: - - '14993' + - '14995' status: code: 202 message: Accepted @@ -3438,15 +3532,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/be30cade-7efc-4730-b912-99de846b4ef5?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/55eb0152-2f8b-4dbc-8879-616ac88b7596?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:06:34.7131005+00:00\",\r\n \"endTime\": - \"2021-10-12T07:06:35.1349767+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"be30cade-7efc-4730-b912-99de846b4ef5\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:02:44.6312387+00:00\",\r\n \"endTime\": + \"2022-01-06T08:02:45.0687755+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"55eb0152-2f8b-4dbc-8879-616ac88b7596\"\r\n}" headers: cache-control: - no-cache @@ -3455,7 +3549,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:44 GMT + - Thu, 06 Jan 2022 08:02:54 GMT expires: - '-1' pragma: @@ -3472,7 +3566,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29887 + - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29948 status: code: 200 message: OK diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_extension_image.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_extension_image.yaml index 1feaf97f4206..3b450e17d0e2 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_extension_image.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_extension_image.yaml @@ -9,14 +9,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers/Microsoft.Compute/artifacttypes/vmextension/types/VMAccessAgent/versions/1.0.2?api-version=2021-07-01 response: body: string: "{\r\n \"properties\": {\r\n \"operatingSystem\": \"Windows\",\r\n - \ \"computeRole\": \"IaaS\",\r\n \"vmScaleSetEnabled\": false,\r\n \"supportsMultipleExtensions\": + \ \"computeRole\": \"IaaS\",\r\n \"architecture\": [\r\n \"x64\"\r\n + \ ],\r\n \"vmScaleSetEnabled\": false,\r\n \"supportsMultipleExtensions\": false,\r\n \"rollbackSupported\": false,\r\n \"isInternalExtension\": false,\r\n \"isJsonExtension\": false\r\n },\r\n \"location\": \"eastus\",\r\n \ \"name\": \"1.0.2\",\r\n \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Compute/ArtifactTypes/VMExtension/Types/VMAccessAgent/Versions/1.0.2\"\r\n}" @@ -24,11 +25,11 @@ interactions: cache-control: - no-cache content-length: - - '508' + - '552' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:48 GMT + - Thu, 06 Jan 2022 08:02:57 GMT expires: - '-1' pragma: @@ -59,7 +60,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers/Microsoft.Compute/artifacttypes/vmextension/types?api-version=2021-07-01 @@ -82,7 +83,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:48 GMT + - Thu, 06 Jan 2022 08:02:57 GMT expires: - '-1' pragma: @@ -113,7 +114,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers/Microsoft.Compute/artifacttypes/vmextension/types/VMAccessAgent/versions?api-version=2021-07-01 @@ -158,7 +159,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:48 GMT + - Thu, 06 Jan 2022 08:02:57 GMT expires: - '-1' pragma: diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_image.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_image.yaml index 88d6b38a5d37..af6c274c669b 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_image.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vm.test_compute_vm_image.yaml @@ -9,7 +9,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers/MicrosoftWindowsServer/artifacttypes/vmimage/offers/WindowsServer/skus/2019-Datacenter/versions/2019.0.20190115?api-version=2021-07-01 @@ -18,20 +18,20 @@ interactions: string: "{\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n \"architecture\": \"x64\",\r\n \"replicaType\": \"Unmanaged\",\r\n \"disallowed\": {\r\n \ \"vmDiskType\": \"None\"\r\n },\r\n \"automaticOSUpgradeProperties\": - {\r\n \"automaticOSUpgradeSupported\": true\r\n },\r\n \"osDiskImage\": - {\r\n \"operatingSystem\": \"Windows\",\r\n \"sizeInGb\": 128,\r\n - \ \"sizeInBytes\": 136367309312\r\n },\r\n \"dataDiskImages\": []\r\n - \ },\r\n \"location\": \"eastus\",\r\n \"name\": \"2019.0.20190115\",\r\n - \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/2019.0.20190115\"\r\n}" + {\r\n \"automaticOSUpgradeSupported\": true\r\n },\r\n \"imageDeprecationStatus\": + {\r\n \"imageState\": \"Active\"\r\n },\r\n \"osDiskImage\": {\r\n + \ \"operatingSystem\": \"Windows\",\r\n \"sizeInGb\": 128,\r\n \"sizeInBytes\": + 136367309312\r\n },\r\n \"dataDiskImages\": []\r\n },\r\n \"location\": + \"eastus\",\r\n \"name\": \"2019.0.20190115\",\r\n \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/2019.0.20190115\"\r\n}" headers: cache-control: - no-cache content-length: - - '706' + - '777' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:52 GMT + - Thu, 06 Jan 2022 08:03:01 GMT expires: - '-1' pragma: @@ -62,19 +62,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers/MicrosoftWindowsServer/artifacttypes/vmimage/offers/WindowsServer/skus/2019-Datacenter/versions?api-version=2021-07-01 response: body: - string: "[\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.1518.2010132039\",\r\n - \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.1518.2010132039\"\r\n - \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.1577.2011031610\",\r\n - \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.1577.2011031610\"\r\n - \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.1579.2011180054\",\r\n - \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.1579.2011180054\"\r\n - \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.1637.2012040632\",\r\n + string: "[\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.1637.2012040632\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.1637.2012040632\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.1697.2101090203\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.1697.2101090203\"\r\n @@ -96,6 +90,12 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.2114.2108051826\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.2183.2109130127\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.2183.2109130127\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.2237.2110070715\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.2237.2110070715\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.3124.2111130129\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.3124.2111130129\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"17763.3125.2112070401\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.3125.2112070401\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"2019.0.20181107\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/2019.0.20181107\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"2019.0.20181122\",\r\n @@ -119,7 +119,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:53 GMT + - Thu, 06 Jan 2022 08:03:01 GMT expires: - '-1' pragma: @@ -150,7 +150,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers/MicrosoftWindowsServer/artifacttypes/vmimage/offers?api-version=2021-07-01 @@ -209,7 +209,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:53 GMT + - Thu, 06 Jan 2022 08:03:01 GMT expires: - '-1' pragma: @@ -240,7 +240,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers?api-version=2021-07-01 @@ -260,12 +260,18 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1597644262255\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1598955805825\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1598955805825\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1602067018799\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1602067018799\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1604579683207\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1604579683207\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1615257339685\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1615257339685\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1615278064010\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1615278064010\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1615455873642\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1615455873642\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1624590941808\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1624590941808\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"1e\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/1e\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"2021ai\",\r\n @@ -422,6 +428,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/aquaforest\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"aquantyinc1598537176913\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/aquantyinc1598537176913\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"aquaveollc1633710529908\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/aquaveollc1633710529908\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"arabesque-group\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/arabesque-group\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"arangodb\",\r\n @@ -514,6 +522,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/AzureDatabricks\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"azureopenshift\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/azureopenshift\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"AzureRT.PIR.Synthetics.ProdTest\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/AzureRT.PIR.Synthetics.ProdTest\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"AzureRT.Test\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/AzureRT.Test\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"azuretesting\",\r\n @@ -552,6 +562,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/bi-builders-as\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"big-id\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/big-id\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"biolibinc1622552350258\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/biolibinc1622552350258\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"bissantechnology1583581147809\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/bissantechnology1583581147809\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"bitdefendercybersecurity\",\r\n @@ -582,6 +594,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/bloombase\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"bluecat\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/bluecat\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"bluejeansnetwork1638333611902\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/bluejeansnetwork1638333611902\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"blueprismlimited-4827145\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/blueprismlimited-4827145\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"bluetalon\",\r\n @@ -620,6 +634,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/bt-americas-inc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"buddhalabs\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/buddhalabs\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cadosecurityltd1626856705534\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/cadosecurityltd1626856705534\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"calculated_systems\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/calculated_systems\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"caloudi_corp\",\r\n @@ -658,6 +674,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/centrixeltd1594135951373\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"centrocomputerspa1584528117084\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/centrocomputerspa1584528117084\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"certifiedsecuritysolutionsinc\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/certifiedsecuritysolutionsinc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"certivox\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/certivox\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cfd-direct\",\r\n @@ -740,6 +758,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/cloudsoft\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cloudwhizsolutions\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/cloudwhizsolutions\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cloudwrxsconsultingltd1631029702055\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/cloudwrxsconsultingltd1631029702055\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"clustrix\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/clustrix\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cncf-upstream\",\r\n @@ -752,6 +772,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/codenvy\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"codetwo\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/codetwo\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cognexcorporation1613759804979\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/cognexcorporation1613759804979\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cognitive-scale\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/cognitive-scale\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"cognizant\",\r\n @@ -770,6 +792,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/collabcloudlimited\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"collibranv1619508098620\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/collibranv1619508098620\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"commscopeinc1632135151062\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/commscopeinc1632135151062\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"commvault\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/commvault\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"compellon\",\r\n @@ -872,6 +896,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/datapredsa\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"dataroadtechnologiesllc\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/dataroadtechnologiesllc\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"datasciencedojo1586563145740\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/datasciencedojo1586563145740\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"datastax\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/datastax\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"datasunrise\",\r\n @@ -892,6 +918,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/deepcognitioninc1593512758156\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"deepsiginc1581610210151\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/deepsiginc1581610210151\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"deepsurfacesecurityinc1632943333445\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/deepsurfacesecurityinc1632943333445\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"dellemc\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/dellemc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"dell_software\",\r\n @@ -982,6 +1010,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/eastwind-networks-inc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"easysoftwaresro1593005637384\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/easysoftwaresro1593005637384\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"ebesllc1637780200500\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/ebesllc1637780200500\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"ecessa\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/ecessa\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"edevtech\",\r\n @@ -994,6 +1024,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/edispheresoftwareprivatelimited1606199736428\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"education4sight\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/education4sight\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"eecservicesfzllc1604836615706\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/eecservicesfzllc1604836615706\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"egnyte\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/egnyte\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"egress1589289169584\",\r\n @@ -1022,6 +1054,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/energisme1601990637842\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"enforongo\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/enforongo\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"engineering-ingegneriainformatica-spa1626786889850\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/engineering-ingegneriainformatica-spa1626786889850\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"engysltd1624364546407\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/engysltd1624364546407\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"enterprise-ethereum-alliance\",\r\n @@ -1030,6 +1064,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/enterprisedb-corp\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"enterpriseworx-it\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/enterpriseworx-it\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"epicgamesinc1633466121071\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/epicgamesinc1633466121071\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"eproe\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/eproe\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"equalum\",\r\n @@ -1052,8 +1088,12 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/esyon\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"ethereum\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/ethereum\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"eurolinuxspzoo1620639373013\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/eurolinuxspzoo1620639373013\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"eventtracker\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/eventtracker\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"evertzmicrosystemsltd1586877923009\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/evertzmicrosystemsltd1586877923009\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"evostream-inc\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/evostream-inc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"exact\",\r\n @@ -1068,6 +1108,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/exonar\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"f5-networks\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/f5-networks\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"falainapteltd1604661424876\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/falainapteltd1604661424876\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"falconstorsoftware\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/falconstorsoftware\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"fatalsecurity1604924013537\",\r\n @@ -1292,6 +1334,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/industry-weapon\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"industryweapon1587162781833\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/industryweapon1587162781833\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"inergybv1637141413454\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/inergybv1637141413454\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"infinitesoftwarecorporation1579223971125\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/infinitesoftwarecorporation1579223971125\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"infiotinc1614034091460\",\r\n @@ -1308,6 +1352,10 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/informatica\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"informationbuilders\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/informationbuilders\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"informationtechnologies_ltd_1179601\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/informationtechnologies_ltd_1179601\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"infotecsinternetsecuritysoftwaregmbh1636129257584\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/infotecsinternetsecuritysoftwaregmbh1636129257584\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"infront-consulting-group-ltd\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/infront-consulting-group-ltd\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"infscapeughaftungsbeschrnkt\",\r\n @@ -1318,6 +1366,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/ingrammicro\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"innomindssoftware\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/innomindssoftware\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"innosepgmbh1618331344164\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/innosepgmbh1618331344164\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"innovatorartificialtechsrl1619180685551\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/innovatorartificialtechsrl1619180685551\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"innovtech\",\r\n @@ -1438,6 +1488,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/kobalt\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"kognillc1600118221163\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/kognillc1600118221163\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"kognitivsparkinc\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/kognitivsparkinc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"konginc1581527938760\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/konginc1581527938760\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"konsys-ltd\",\r\n @@ -1466,6 +1518,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/leostream-corporation\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"lepide-software\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/lepide-software\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"levacloudllc1602151818089\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/levacloudllc1602151818089\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"libelleag\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/libelleag\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"liberatii\",\r\n @@ -1498,8 +1552,12 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/lnw-softgmbh\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"loadbalancer\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/loadbalancer\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"logicflowag1638535407949\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/logicflowag1638535407949\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"logsign\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/logsign\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"logstarecorp1635838645101\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/logstarecorp1635838645101\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"logtrust\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/logtrust\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"logzio\",\r\n @@ -1516,6 +1574,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/M365SecurityInventory\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"machinesense\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/machinesense\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"madhavajay1632269232059\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/madhavajay1632269232059\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"maidenhead-bridge\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/maidenhead-bridge\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"manageengine\",\r\n @@ -1552,6 +1612,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/mediatekinc1586141563888\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"mendix\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/mendix\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"merlynnintelligencetechnologies\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/merlynnintelligencetechnologies\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"meshifyappinc1622759451429\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/meshifyappinc1622759451429\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"messagesolution\",\r\n @@ -2030,6 +2092,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.LabServices\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.LabServices.test\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.LabServices.test\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.MeshVPN.Internal\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.MeshVPN.Internal\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Monitor\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Monitor\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Monitor.Agent\",\r\n @@ -2068,6 +2132,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Monitor.WorkloadInsightsTest.newnamespace\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Monitor.Workloads\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Monitor.Workloads\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Monitor.Workloads.Dev\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Monitor.Workloads.Dev\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Monitoring.DependencyAgent\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Monitoring.DependencyAgent\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Monitoring.DependencyAgent.Edp\",\r\n @@ -2126,6 +2192,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Security.WindowsAttestation\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Security.WinTestAttestation\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Security.WinTestAttestation\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.Sentinel.DnsExtension.Dev\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.Sentinel.DnsExtension.Dev\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.ServiceFabric.MC\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Azure.ServiceFabric.MC\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Azure.ServiceFabric.MC.Test\",\r\n @@ -2224,6 +2292,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.CPlat.Core\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.CPlat.Core.Edp\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.CPlat.Core.Edp\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Dcsswe.Extensions\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Dcsswe.Extensions\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.EnterpriseCloud.Monitoring\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.EnterpriseCloud.Monitoring\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.EnterpriseCloud.Monitoring.Edp\",\r\n @@ -2276,6 +2346,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Powershell.Test\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.Powershell.Test01\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.Powershell.Test01\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.RecoveryServices.Test\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.RecoveryServices.Test\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.SecurityManagement.Kevlar\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/Microsoft.SecurityManagement.Kevlar\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Microsoft.SoftwareUpdateManagement\",\r\n @@ -2342,6 +2414,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftCBLMariner\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"microsoftcmotest\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/microsoftcmotest\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"microsoftcorporation1602274591143\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/microsoftcorporation1602274591143\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"microsoftcorporation1620407702632\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/microsoftcorporation1620407702632\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"MicrosoftDynamicsAX\",\r\n @@ -2396,6 +2470,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/miracl_linux\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"miri-infotech-pvt-ltd\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/miri-infotech-pvt-ltd\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"mistio1601460379393\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/mistio1601460379393\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"mobilab\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/mobilab\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"modern-systems\",\r\n @@ -2504,6 +2580,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/nilespartnersinc1617691698386\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"niolabs-5229713\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/niolabs-5229713\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"nirvatosoftwarepvtltd1601368706606\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/nirvatosoftwarepvtltd1601368706606\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"nodejsapi\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/nodejsapi\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"noianetworklimited1584098036197\",\r\n @@ -2528,6 +2606,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/ntt-data-intellilink-corporation\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"nttdata\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/nttdata\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"nttltd\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/nttltd\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"nuco-networks\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/nuco-networks\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"numbersbelieve\",\r\n @@ -2640,6 +2720,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/parallels\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"parasoft\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/parasoft\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"parsec-for-teams\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/parsec-for-teams\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"pasifikciptamandiri\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/pasifikciptamandiri\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"passlogy\",\r\n @@ -2668,6 +2750,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/pmsoftwareinternational1603102514882\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"pnop\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/pnop\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"polarityioinc1628691850891\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/polarityioinc1628691850891\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"portalarchitects\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/portalarchitects\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"portsysinc\",\r\n @@ -2722,6 +2806,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/ptsecurity\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"pulse-secure\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/pulse-secure\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"pulsesecuretechnologies1638179500151\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/pulsesecuretechnologies1638179500151\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"puppet\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/puppet\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"puppeteersoy1601024480557\",\r\n @@ -2760,6 +2846,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/quest\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"racknap\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/racknap\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"rackwareinc1619403669255\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/rackwareinc1619403669255\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"radiant-logic\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/radiant-logic\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"radware\",\r\n @@ -2784,6 +2872,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/reblaze\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"RedHat\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/RedHat\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"redhat-rhel\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/redhat-rhel\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"redpoint-global\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/redpoint-global\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"refactr\",\r\n @@ -2872,6 +2962,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/samsungsds-cello\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"samsungsds_sdbe\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/samsungsds_sdbe\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"sandhatatechnologieslimited1615753438737\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/sandhatatechnologieslimited1615753438737\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"sap\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/sap\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"sapphiretechnologieslimited1611758579346\",\r\n @@ -2896,6 +2988,10 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/scientiamobile\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"scontainug1595751515785\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/scontainug1595751515785\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"scubaanalytics\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/scubaanalytics\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"scylladb1631195365807\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/scylladb1631195365807\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"seaqserviciossas1579029207572\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/seaqserviciossas1579029207572\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"secureworks\",\r\n @@ -2934,6 +3030,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/seraumo1620002807288\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"service-control-inc\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/service-control-inc\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"sesamesoftwareinc1622125191447\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/sesamesoftwareinc1622125191447\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"shadow-soft\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/shadow-soft\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"shareshiftneeraj.test\",\r\n @@ -2950,6 +3048,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/simmachinesinc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"simontelephonics\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/simontelephonics\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"simpledatalabsinc1635791235920\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/simpledatalabsinc1635791235920\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"simplifierag\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/simplifierag\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"simpligov\",\r\n @@ -3006,6 +3106,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/sonicwall-inc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"sophos\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/sophos\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"sourcegearllc1616101262784\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/sourcegearllc1616101262784\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"south-river-technologies\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/south-river-technologies\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"southrivertech1586314123192\",\r\n @@ -3048,6 +3150,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/stackstorm\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"startekfingerprintmatch\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/startekfingerprintmatch\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"startisolucoesemtecnologialtda1635263523201\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/startisolucoesemtecnologialtda1635263523201\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"starwind\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/starwind\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"StatusMonitor2.Diagnostics.Test\",\r\n @@ -3076,6 +3180,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/strangebee1595948424730\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"strataidentity1608323708170\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/strataidentity1608323708170\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"stratis-group-ltd\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/stratis-group-ltd\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"stratodesk1611152769936\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/stratodesk1611152769936\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"stratumn\",\r\n @@ -3178,6 +3284,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/techdivision\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"techlatest\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/techlatest\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"technicheltd1606969724100\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/technicheltd1606969724100\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"tecknolab\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/tecknolab\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"telepat\",\r\n @@ -3228,6 +3336,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/test_test_pmc2pc1\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"thales-vormetric\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/thales-vormetric\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"thalesdiscplusainc1596561677238\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/thalesdiscplusainc1596561677238\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"thedatavaluefactoryltd1589348815922\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/thedatavaluefactoryltd1589348815922\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"thefreebsdfoundation\",\r\n @@ -3406,6 +3516,8 @@ interactions: \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/vnomicinc\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"voiceelements\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/voiceelements\"\r\n + \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"voleatechgmbh1636966911943\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/voleatechgmbh1636966911943\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"volterraedgeservices\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/volterraedgeservices\"\r\n \ },\r\n {\r\n \"location\": \"eastus\",\r\n \"name\": \"Vormetric\",\r\n @@ -3525,11 +3637,11 @@ interactions: cache-control: - no-cache content-length: - - '372354' + - '385294' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:53 GMT + - Thu, 06 Jan 2022 08:03:01 GMT expires: - '-1' pragma: @@ -3558,7 +3670,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/publishers/MicrosoftWindowsServer/artifacttypes/vmimage/offers/WindowsServer/skus?api-version=2021-07-01 @@ -3766,6 +3878,18 @@ interactions: \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2022-datacenter\"\r\n \ },\r\n {\r\n \"properties\": {\r\n \"automaticOSUpgradeProperties\": {\r\n \"automaticOSUpgradeSupported\": false\r\n }\r\n },\r\n + \ \"location\": \"eastus\",\r\n \"name\": \"2022-datacenter-azure-edition\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2022-datacenter-azure-edition\"\r\n + \ },\r\n {\r\n \"properties\": {\r\n \"automaticOSUpgradeProperties\": + {\r\n \"automaticOSUpgradeSupported\": false\r\n }\r\n },\r\n + \ \"location\": \"eastus\",\r\n \"name\": \"2022-datacenter-azure-edition-core\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2022-datacenter-azure-edition-core\"\r\n + \ },\r\n {\r\n \"properties\": {\r\n \"automaticOSUpgradeProperties\": + {\r\n \"automaticOSUpgradeSupported\": false\r\n }\r\n },\r\n + \ \"location\": \"eastus\",\r\n \"name\": \"2022-datacenter-azure-edition-core-smalldisk\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2022-datacenter-azure-edition-core-smalldisk\"\r\n + \ },\r\n {\r\n \"properties\": {\r\n \"automaticOSUpgradeProperties\": + {\r\n \"automaticOSUpgradeSupported\": false\r\n }\r\n },\r\n \ \"location\": \"eastus\",\r\n \"name\": \"2022-datacenter-azure-edition-smalldisk\",\r\n \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2022-datacenter-azure-edition-smalldisk\"\r\n \ },\r\n {\r\n \"properties\": {\r\n \"automaticOSUpgradeProperties\": @@ -3849,11 +3973,11 @@ interactions: cache-control: - no-cache content-length: - - '30398' + - '31731' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:06:54 GMT + - Thu, 06 Jan 2022 08:03:01 GMT expires: - '-1' pragma: diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_perform_maintenance.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_perform_maintenance.yaml index 2ad4a53a5e6a..74098b02ddf0 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_perform_maintenance.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_perform_maintenance.yaml @@ -14,17 +14,17 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamexfe411907\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907\",\r\n - \ \"etag\": \"W/\\\"f8e8c2a8-1668-48c2-8435-cf1919acf1e4\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"e89a9899-5bf5-4de5-bd85-8c787916fe7f\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"f7444c7d-90d4-45f6-942f-e972e4f6959f\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"9182eba9-0fa6-41e9-aba7-0bca57b2e3b9\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -32,7 +32,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/c1b49d02-9807-4cd2-a8d9-288556f9be03?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/4097b9d4-2f44-4003-96d4-a6018529a440?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -40,7 +40,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:00 GMT + - Thu, 06 Jan 2022 08:03:07 GMT expires: - '-1' pragma: @@ -53,7 +53,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 4735566f-871b-4505-a08f-3742ba13ea6a + - a7063987-c328-4d97-a094-2eff651b3fe9 x-ms-ratelimit-remaining-subscription-writes: - '1199' status: @@ -69,10 +69,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/c1b49d02-9807-4cd2-a8d9-288556f9be03?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/4097b9d4-2f44-4003-96d4-a6018529a440?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -84,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:03 GMT + - Thu, 06 Jan 2022 08:03:10 GMT expires: - '-1' pragma: @@ -101,7 +101,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 252d505d-6714-4865-b2f3-55644acd57c4 + - 5c8d54fb-ea83-4feb-8f81-9d1812197d03 status: code: 200 message: OK @@ -115,17 +115,17 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamexfe411907\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907\",\r\n - \ \"etag\": \"W/\\\"dc5f9358-a958-4646-a1df-c1e26595ff87\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"0c05e19d-b4b5-4666-ac4c-3e7afb5bba24\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"f7444c7d-90d4-45f6-942f-e972e4f6959f\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"9182eba9-0fa6-41e9-aba7-0bca57b2e3b9\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -137,9 +137,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:03 GMT + - Thu, 06 Jan 2022 08:03:10 GMT etag: - - W/"dc5f9358-a958-4646-a1df-c1e26595ff87" + - W/"0c05e19d-b4b5-4666-ac4c-3e7afb5bba24" expires: - '-1' pragma: @@ -156,7 +156,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 17ebaf97-4dd4-4e24-87c5-2dd62802a61d + - 4fea3ca6-ae0e-4940-b512-a45019ab331f status: code: 200 message: OK @@ -174,21 +174,21 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetnamexfe411907\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907\",\r\n - \ \"etag\": \"W/\\\"454ab5ee-1039-4b5d-88cf-55b0e29e3036\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"7d612ab6-19ae-4ba6-8468-10c16848607e\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/d12edf3c-2d0c-4226-89d0-f63215413399?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/1b4687a7-de34-49d3-89c6-7b7cef894ca1?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -196,7 +196,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:04 GMT + - Thu, 06 Jan 2022 08:03:10 GMT expires: - '-1' pragma: @@ -209,7 +209,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - a3071a87-c215-463c-883c-865398a2801b + - 88caf1c9-21f3-467a-8ba2-7037cb719909 x-ms-ratelimit-remaining-subscription-writes: - '1198' status: @@ -225,10 +225,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/d12edf3c-2d0c-4226-89d0-f63215413399?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/1b4687a7-de34-49d3-89c6-7b7cef894ca1?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -240,7 +240,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:07 GMT + - Thu, 06 Jan 2022 08:03:13 GMT expires: - '-1' pragma: @@ -257,7 +257,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - aed9ccd6-e72e-41ff-a464-f41b86899fb1 + - 6ab03dd8-ad12-4675-be72-fe1322f8e865 status: code: 200 message: OK @@ -271,14 +271,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetnamexfe411907\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907\",\r\n - \ \"etag\": \"W/\\\"dd873fd0-abcd-4349-a1ac-636180cbf701\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"6cc5b10b-fa6c-4a49-b538-10f9cd5704af\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": @@ -291,9 +291,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:07 GMT + - Thu, 06 Jan 2022 08:03:13 GMT etag: - - W/"dd873fd0-abcd-4349-a1ac-636180cbf701" + - W/"6cc5b10b-fa6c-4a49-b538-10f9cd5704af" expires: - '-1' pragma: @@ -310,7 +310,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - ab951eb9-0d35-4fb2-9d3b-8cb18da8ee0c + - c4d6c198-46a1-4451-a655-4877a386c1a7 status: code: 200 message: OK @@ -338,7 +338,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetfe411907?api-version=2021-07-01 @@ -363,12 +363,12 @@ interactions: \"latest\"\r\n }\r\n },\r\n \"networkProfile\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]}\r\n \ },\r\n \"provisioningState\": \"Creating\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": - \"ca5869f6-e5a3-4ffb-8d31-e9b48230bad9\"\r\n }\r\n}" + \"7760e1cc-dd79-49d7-8805-370ba3df7295\"\r\n }\r\n}" headers: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/b6b464ee-2be3-4e26-ba97-eb6eb539b061?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/14089f46-540d-479b-95a0-9db76daf78e6?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -376,7 +376,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:11 GMT + - Thu, 06 Jan 2022 08:03:15 GMT expires: - '-1' pragma: @@ -389,9 +389,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/CreateVMScaleSet3Min;185,Microsoft.Compute/CreateVMScaleSet30Min;930,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3724,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/CreateVMScaleSet3Min;185,Microsoft.Compute/CreateVMScaleSet30Min;931,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3727,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1190' + - '1183' x-ms-request-charge: - '2' status: @@ -407,14 +407,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/b6b464ee-2be3-4e26-ba97-eb6eb539b061?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/14089f46-540d-479b-95a0-9db76daf78e6?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:07:10.2914647+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"b6b464ee-2be3-4e26-ba97-eb6eb539b061\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:03:15.6313364+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"14089f46-540d-479b-95a0-9db76daf78e6\"\r\n}" headers: cache-control: - no-cache @@ -423,7 +423,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:07:21 GMT + - Thu, 06 Jan 2022 08:03:25 GMT expires: - '-1' pragma: @@ -440,7 +440,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29886 + - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29947 status: code: 200 message: OK @@ -454,15 +454,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/b6b464ee-2be3-4e26-ba97-eb6eb539b061?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/14089f46-540d-479b-95a0-9db76daf78e6?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:07:10.2914647+00:00\",\r\n \"endTime\": - \"2021-10-12T07:08:17.8231063+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"b6b464ee-2be3-4e26-ba97-eb6eb539b061\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:03:15.6313364+00:00\",\r\n \"endTime\": + \"2022-01-06T08:04:55.7395857+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"14089f46-540d-479b-95a0-9db76daf78e6\"\r\n}" headers: cache-control: - no-cache @@ -471,7 +471,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:08:59 GMT + - Thu, 06 Jan 2022 08:05:03 GMT expires: - '-1' pragma: @@ -488,7 +488,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14991,Microsoft.Compute/GetOperation30Min;29884 + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29945 status: code: 200 message: OK @@ -502,7 +502,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetfe411907?api-version=2021-07-01 @@ -527,7 +527,7 @@ interactions: \"latest\"\r\n }\r\n },\r\n \"networkProfile\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexfe411907/subnets/subnetnamexfe411907\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]}\r\n \ },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": - \"ca5869f6-e5a3-4ffb-8d31-e9b48230bad9\"\r\n }\r\n}" + \"7760e1cc-dd79-49d7-8805-370ba3df7295\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -536,7 +536,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:08:59 GMT + - Thu, 06 Jan 2022 08:05:03 GMT expires: - '-1' pragma: @@ -553,7 +553,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetVMScaleSet3Min;398,Microsoft.Compute/GetVMScaleSet30Min;2597 + - Microsoft.Compute/GetVMScaleSet3Min;398,Microsoft.Compute/GetVMScaleSet30Min;2598 status: code: 200 message: OK @@ -567,40 +567,39 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetfe411907/virtualmachines/0/instanceView?api-version=2021-07-01 response: body: - string: "{\r\n \"placementGroupId\": \"7093d997-e6d3-4a38-a347-07eb63601d9c\",\r\n + string: "{\r\n \"placementGroupId\": \"fc16e467-626f-48fa-9ac9-342b66113e3e\",\r\n \ \"platformUpdateDomain\": 0,\r\n \"platformFaultDomain\": 0,\r\n \"computerName\": \"testPC000000\",\r\n \"osName\": \"Windows Server 2016 Datacenter\",\r\n - \ \"osVersion\": \"Windows:Windows Server 2016 Datacenter-10.0.14393.4651\",\r\n - \ \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.7.41491.1024\",\r\n \"statuses\": - [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": - \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": - \"GuestAgent is running and processing the extensions.\",\r\n \"time\": - \"2021-10-12T07:11:12+00:00\"\r\n }\r\n ]\r\n },\r\n \"disks\": - [\r\n {\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_e34a823dc6b9443bbac8218b8cfc2122\",\r\n + \ \"osVersion\": \"10.0.14393.4825\",\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": + \"2.7.41491.1032\",\r\n \"statuses\": [\r\n {\r\n \"code\": + \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": + \"Ready\",\r\n \"message\": \"GuestAgent is running and processing + the extensions.\",\r\n \"time\": \"2022-01-06T08:08:01.793+00:00\"\r\n + \ }\r\n ]\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_183e539832f8465f9e30f85b248dfa10\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-10-12T07:08:18.4481068+00:00\"\r\n + succeeded\",\r\n \"time\": \"2022-01-06T08:04:56.4271315+00:00\"\r\n \ }\r\n ]\r\n }\r\n ],\r\n \"hyperVGeneration\": \"V1\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n - \ \"time\": \"2021-10-12T07:09:07.6828006+00:00\"\r\n },\r\n {\r\n + \ \"time\": \"2022-01-06T08:05:38.0844773+00:00\"\r\n },\r\n {\r\n \ \"code\": \"PowerState/running\",\r\n \"level\": \"Info\",\r\n \ \"displayStatus\": \"VM running\"\r\n }\r\n ]\r\n}" headers: cache-control: - no-cache content-length: - - '1339' + - '1304' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:11:59 GMT + - Thu, 06 Jan 2022 08:08:03 GMT expires: - '-1' pragma: @@ -637,7 +636,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetfe411907/performMaintenance?api-version=2021-07-01 @@ -645,16 +644,16 @@ interactions: body: string: "{\r\n \"error\": {\r\n \"code\": \"OperationNotAllowed\",\r\n \"message\": \"Operation 'performMaintenance' is not allowed on VM 'virtualmachinescalesetfe411907_0' - since the Subscription of this VM is not eligible.\"\r\n }\r\n}" + as customer initiated maintenance is not allowed.\"\r\n }\r\n}" headers: cache-control: - no-cache content-length: - - '215' + - '214' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:12:00 GMT + - Thu, 06 Jan 2022 08:08:03 GMT expires: - '-1' pragma: @@ -669,7 +668,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/VMScaleSetActions3Min;239,Microsoft.Compute/VMScaleSetActions30Min;1199 x-ms-ratelimit-remaining-subscription-writes: - - '1190' + - '1188' status: code: 409 message: Conflict @@ -685,7 +684,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetfe411907/virtualmachines/0/performMaintenance?api-version=2021-07-01 @@ -693,16 +692,16 @@ interactions: body: string: "{\r\n \"error\": {\r\n \"code\": \"OperationNotAllowed\",\r\n \"message\": \"Operation 'performMaintenance' is not allowed on VM 'virtualmachinescalesetfe411907_0' - since the Subscription of this VM is not eligible.\"\r\n }\r\n}" + as customer initiated maintenance is not allowed.\"\r\n }\r\n}" headers: cache-control: - no-cache content-length: - - '215' + - '214' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:12:00 GMT + - Thu, 06 Jan 2022 08:08:03 GMT expires: - '-1' pragma: @@ -717,7 +716,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1198 x-ms-ratelimit-remaining-subscription-writes: - - '1189' + - '1187' status: code: 409 message: Conflict @@ -733,7 +732,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetfe411907?api-version=2021-07-01 @@ -744,17 +743,17 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3b8246dc-e9a6-48bb-8fd5-494d6993f792?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/759683ea-06eb-4ce7-addd-9a3a79033ad3?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:12:00 GMT + - Thu, 06 Jan 2022 08:08:03 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3b8246dc-e9a6-48bb-8fd5-494d6993f792?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/759683ea-06eb-4ce7-addd-9a3a79033ad3?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -765,9 +764,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteVMScaleSet3Min;79,Microsoft.Compute/DeleteVMScaleSet30Min;399,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3725,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/DeleteVMScaleSet3Min;79,Microsoft.Compute/DeleteVMScaleSet30Min;399,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3728,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-deletes: - - '14992' + - '14994' x-ms-request-charge: - '1' status: @@ -783,23 +782,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3b8246dc-e9a6-48bb-8fd5-494d6993f792?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/759683ea-06eb-4ce7-addd-9a3a79033ad3?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:12:00.840083+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"3b8246dc-e9a6-48bb-8fd5-494d6993f792\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:08:03.6782137+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"759683ea-06eb-4ce7-addd-9a3a79033ad3\"\r\n}" headers: cache-control: - no-cache content-length: - - '133' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:12:10 GMT + - Thu, 06 Jan 2022 08:08:13 GMT expires: - '-1' pragma: @@ -816,7 +815,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29893 + - Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29943 status: code: 200 message: OK @@ -830,23 +829,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3b8246dc-e9a6-48bb-8fd5-494d6993f792?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/759683ea-06eb-4ce7-addd-9a3a79033ad3?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:12:00.840083+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"3b8246dc-e9a6-48bb-8fd5-494d6993f792\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:08:03.6782137+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"759683ea-06eb-4ce7-addd-9a3a79033ad3\"\r\n}" headers: cache-control: - no-cache content-length: - - '133' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:12:21 GMT + - Thu, 06 Jan 2022 08:08:24 GMT expires: - '-1' pragma: @@ -863,7 +862,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29892 + - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29942 status: code: 200 message: OK @@ -877,24 +876,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3b8246dc-e9a6-48bb-8fd5-494d6993f792?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/759683ea-06eb-4ce7-addd-9a3a79033ad3?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:12:00.840083+00:00\",\r\n \"endTime\": - \"2021-10-12T07:12:41.4184367+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"3b8246dc-e9a6-48bb-8fd5-494d6993f792\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:08:03.6782137+00:00\",\r\n \"endTime\": + \"2022-01-06T08:08:44.2719753+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"759683ea-06eb-4ce7-addd-9a3a79033ad3\"\r\n}" headers: cache-control: - no-cache content-length: - - '183' + - '184' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:12:52 GMT + - Thu, 06 Jan 2022 08:08:54 GMT expires: - '-1' pragma: @@ -911,7 +910,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29890 + - Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29941 status: code: 200 message: OK diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm.yaml index 2c5ff257297c..23378587c331 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm.yaml @@ -14,17 +14,17 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamex8c68120d\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d\",\r\n - \ \"etag\": \"W/\\\"e7b46ff0-2e4c-49f1-9aed-2d53c9fdf274\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"5e9edd1b-7ff5-479d-8e4d-8ef41ee3cebf\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"2d070d85-bb49-4fb8-a973-8c14cb778686\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"e7a87423-5259-40df-a228-26f5e45cfe97\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -32,7 +32,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/136f341d-b58e-4a12-ab28-a3c92b748e9a?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/28ff4b43-c23e-4fab-b506-d77abf87b454?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -40,7 +40,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:12:56 GMT + - Thu, 06 Jan 2022 08:08:57 GMT expires: - '-1' pragma: @@ -53,9 +53,9 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 18236eb5-d5c8-459a-af7e-b65a199d1a95 + - e3ce7f83-530e-4321-bfa3-83a15ec00c6e x-ms-ratelimit-remaining-subscription-writes: - - '1189' + - '1182' status: code: 201 message: Created @@ -69,56 +69,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/136f341d-b58e-4a12-ab28-a3c92b748e9a?api-version=2021-03-01 - response: - body: - string: "{\r\n \"status\": \"InProgress\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '30' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 12 Oct 2021 07:12:59 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - 028abbd2-4906-4c58-8b8b-90adf18ab268 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/136f341d-b58e-4a12-ab28-a3c92b748e9a?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/28ff4b43-c23e-4fab-b506-d77abf87b454?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -130,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:13:09 GMT + - Thu, 06 Jan 2022 08:09:00 GMT expires: - '-1' pragma: @@ -147,7 +101,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 73585858-9623-4136-93e6-00a46e3d29b9 + - 80612cb8-00bd-42b1-9b6b-8812412042f7 status: code: 200 message: OK @@ -161,17 +115,17 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamex8c68120d\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d\",\r\n - \ \"etag\": \"W/\\\"75769609-74ac-49dd-95a7-f655ad1415f3\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"f7187df6-33da-42e8-abb4-6140fbe73f9d\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"2d070d85-bb49-4fb8-a973-8c14cb778686\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"e7a87423-5259-40df-a228-26f5e45cfe97\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -183,9 +137,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:13:09 GMT + - Thu, 06 Jan 2022 08:09:00 GMT etag: - - W/"75769609-74ac-49dd-95a7-f655ad1415f3" + - W/"f7187df6-33da-42e8-abb4-6140fbe73f9d" expires: - '-1' pragma: @@ -202,7 +156,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - d8874803-7d85-4655-9356-179a517e3946 + - 45ca4ae9-53d7-4bcf-b74b-e72e01f898b1 status: code: 200 message: OK @@ -220,21 +174,21 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetnamex8c68120d\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d\",\r\n - \ \"etag\": \"W/\\\"269b8d05-24be-4ee5-8714-1559bb089a47\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"c3c7a523-c8f4-49be-9190-29b36a27df43\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/f0349818-1f9d-40b8-9051-c672bc84a2a6?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/a8d4d473-8a5f-453b-8c71-4dcdf7784078?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -242,7 +196,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:13:10 GMT + - Thu, 06 Jan 2022 08:09:00 GMT expires: - '-1' pragma: @@ -255,9 +209,9 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 7fa2d406-d396-4425-b57b-02f81608ec37 + - 1f986731-37ea-493a-9d41-8912358623b8 x-ms-ratelimit-remaining-subscription-writes: - - '1188' + - '1181' status: code: 201 message: Created @@ -271,56 +225,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/f0349818-1f9d-40b8-9051-c672bc84a2a6?api-version=2021-03-01 - response: - body: - string: "{\r\n \"status\": \"InProgress\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '30' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 12 Oct 2021 07:13:13 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - 2e88f0f5-166d-41a8-8bf6-a03fe1ab9cb7 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/f0349818-1f9d-40b8-9051-c672bc84a2a6?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/a8d4d473-8a5f-453b-8c71-4dcdf7784078?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -332,7 +240,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:13:23 GMT + - Thu, 06 Jan 2022 08:09:03 GMT expires: - '-1' pragma: @@ -349,7 +257,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 77af5fb3-33a8-4e63-9711-fcd1c8c55262 + - bcd501f3-18f1-42dd-89e2-3755f3f1e913 status: code: 200 message: OK @@ -363,14 +271,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetnamex8c68120d\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d\",\r\n - \ \"etag\": \"W/\\\"069e49ad-acd3-43fd-b9fe-8b054559d5bc\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"3fee37ec-b970-4533-a4f0-31c1b2e3eea0\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": @@ -383,9 +291,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:13:23 GMT + - Thu, 06 Jan 2022 08:09:04 GMT etag: - - W/"069e49ad-acd3-43fd-b9fe-8b054559d5bc" + - W/"3fee37ec-b970-4533-a4f0-31c1b2e3eea0" expires: - '-1' pragma: @@ -402,7 +310,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 76bcf3ca-ce01-439e-a4c5-2fb02dce766f + - 2f1f64af-4415-44e4-9b5d-df531251ba82 status: code: 200 message: OK @@ -430,7 +338,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d?api-version=2021-07-01 @@ -455,12 +363,12 @@ interactions: \"latest\"\r\n }\r\n },\r\n \"networkProfile\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]}\r\n \ },\r\n \"provisioningState\": \"Creating\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": - \"5f6963fe-c2c0-4f24-a9a0-7f522d9568c0\"\r\n }\r\n}" + \"e4588217-8540-4ca1-b727-a4edf4c6cb12\"\r\n }\r\n}" headers: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/93b9b7b7-f34f-4c8f-9a38-51d170495867?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f0394cd9-5f90-4e99-8033-6c0104c3755c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -468,7 +376,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:13:28 GMT + - Thu, 06 Jan 2022 08:09:06 GMT expires: - '-1' pragma: @@ -481,9 +389,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/CreateVMScaleSet3Min;185,Microsoft.Compute/CreateVMScaleSet30Min;929,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3723,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/CreateVMScaleSet3Min;185,Microsoft.Compute/CreateVMScaleSet30Min;930,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3726,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - '1194' x-ms-request-charge: - '2' status: @@ -499,14 +407,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/93b9b7b7-f34f-4c8f-9a38-51d170495867?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f0394cd9-5f90-4e99-8033-6c0104c3755c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:13:26.7312149+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"93b9b7b7-f34f-4c8f-9a38-51d170495867\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:09:06.5376071+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"f0394cd9-5f90-4e99-8033-6c0104c3755c\"\r\n}" headers: cache-control: - no-cache @@ -515,7 +423,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:13:38 GMT + - Thu, 06 Jan 2022 08:09:16 GMT expires: - '-1' pragma: @@ -532,7 +440,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29889 + - Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29940 status: code: 200 message: OK @@ -546,24 +454,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/93b9b7b7-f34f-4c8f-9a38-51d170495867?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f0394cd9-5f90-4e99-8033-6c0104c3755c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:13:26.7312149+00:00\",\r\n \"endTime\": - \"2021-10-12T07:14:44.4660863+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"93b9b7b7-f34f-4c8f-9a38-51d170495867\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:09:06.5376071+00:00\",\r\n \"endTime\": + \"2022-01-06T08:10:31.850174+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"f0394cd9-5f90-4e99-8033-6c0104c3755c\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '183' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:15:15 GMT + - Thu, 06 Jan 2022 08:10:53 GMT expires: - '-1' pragma: @@ -580,7 +488,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29895 + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29938 status: code: 200 message: OK @@ -594,7 +502,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d?api-version=2021-07-01 @@ -619,7 +527,7 @@ interactions: \"latest\"\r\n }\r\n },\r\n \"networkProfile\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]}\r\n \ },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": - \"5f6963fe-c2c0-4f24-a9a0-7f522d9568c0\"\r\n }\r\n}" + \"e4588217-8540-4ca1-b727-a4edf4c6cb12\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -628,7 +536,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:15:15 GMT + - Thu, 06 Jan 2022 08:10:53 GMT expires: - '-1' pragma: @@ -645,7 +553,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetVMScaleSet3Min;395,Microsoft.Compute/GetVMScaleSet30Min;2591 + - Microsoft.Compute/GetVMScaleSet3Min;394,Microsoft.Compute/GetVMScaleSet30Min;2590 status: code: 200 message: OK @@ -659,7 +567,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/0/instanceView?api-version=2021-07-01 @@ -675,7 +583,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:18:16 GMT + - Thu, 06 Jan 2022 08:13:53 GMT expires: - '-1' pragma: @@ -704,40 +612,39 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1/instanceView?api-version=2021-07-01 response: body: - string: "{\r\n \"placementGroupId\": \"9f3653dd-70b2-4933-a0d5-ea8c6656031a\",\r\n + string: "{\r\n \"placementGroupId\": \"705dec9a-9e30-463a-942f-9e70446bcc1c\",\r\n \ \"platformUpdateDomain\": 1,\r\n \"platformFaultDomain\": 1,\r\n \"computerName\": \"testPC000001\",\r\n \"osName\": \"Windows Server 2016 Datacenter\",\r\n - \ \"osVersion\": \"Windows:Windows Server 2016 Datacenter-10.0.14393.4651\",\r\n - \ \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.7.41491.1024\",\r\n \"statuses\": - [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": - \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": - \"GuestAgent is running and processing the extensions.\",\r\n \"time\": - \"2021-10-12T07:17:47+00:00\"\r\n }\r\n ]\r\n },\r\n \"disks\": - [\r\n {\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_889c6e8a34cf4935b8b8af7a599b5d4b\",\r\n + \ \"osVersion\": \"10.0.14393.4825\",\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": + \"2.7.41491.1032\",\r\n \"statuses\": [\r\n {\r\n \"code\": + \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": + \"Ready\",\r\n \"message\": \"GuestAgent is running and processing + the extensions.\",\r\n \"time\": \"2022-01-06T08:13:35.9+00:00\"\r\n + \ }\r\n ]\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_49ffb1eb21cc425681653678911d6f84\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-10-12T07:13:31.5437378+00:00\"\r\n + succeeded\",\r\n \"time\": \"2022-01-06T08:09:10.3032557+00:00\"\r\n \ }\r\n ]\r\n }\r\n ],\r\n \"hyperVGeneration\": \"V1\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n - \ \"time\": \"2021-10-12T07:14:44.3879295+00:00\"\r\n },\r\n {\r\n + \ \"time\": \"2022-01-06T08:10:31.7720282+00:00\"\r\n },\r\n {\r\n \ \"code\": \"PowerState/running\",\r\n \"level\": \"Info\",\r\n \ \"displayStatus\": \"VM running\"\r\n }\r\n ]\r\n}" headers: cache-control: - no-cache content-length: - - '1339' + - '1302' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:18:16 GMT + - Thu, 06 Jan 2022 08:13:53 GMT expires: - '-1' pragma: @@ -770,7 +677,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1?api-version=2021-07-01 @@ -783,15 +690,15 @@ interactions: \ \"name\": \"Standard_D1_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \ \"properties\": {\r\n \"latestModelApplied\": true,\r\n \"modelDefinitionApplied\": \"VirtualMachineScaleSet\",\r\n \"networkProfileConfiguration\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]},\r\n - \ \"vmId\": \"66b7eecb-159b-497a-aad6-5b2ceae62e36\",\r\n \"hardwareProfile\": + \ \"vmId\": \"0399d252-0f14-4162-ad43-0a7a5d02e43a\",\r\n \"hardwareProfile\": {},\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": - \"Windows\",\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_889c6e8a34cf4935b8b8af7a599b5d4b\",\r\n + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"Windows\",\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_49ffb1eb21cc425681653678911d6f84\",\r\n \ \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinescalesvirtualmachinescaleseOS__1_889c6e8a34cf4935b8b8af7a599b5d4b\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinescalesvirtualmachinescaleseOS__1_49ffb1eb21cc425681653678911d6f84\"\r\n \ },\r\n \"diskSizeGB\": 512\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"testPC000001\",\r\n \ \"adminUsername\": \"testuser\",\r\n \"windowsConfiguration\": @@ -808,7 +715,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:18:16 GMT + - Thu, 06 Jan 2022 08:13:53 GMT expires: - '-1' pragma: @@ -845,7 +752,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1?api-version=2021-07-01 @@ -858,15 +765,15 @@ interactions: \ \"name\": \"Standard_D1_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \ \"properties\": {\r\n \"latestModelApplied\": true,\r\n \"modelDefinitionApplied\": \"VirtualMachineScaleSet\",\r\n \"networkProfileConfiguration\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]},\r\n - \ \"vmId\": \"66b7eecb-159b-497a-aad6-5b2ceae62e36\",\r\n \"hardwareProfile\": + \ \"vmId\": \"0399d252-0f14-4162-ad43-0a7a5d02e43a\",\r\n \"hardwareProfile\": {},\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": - \"Windows\",\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_889c6e8a34cf4935b8b8af7a599b5d4b\",\r\n + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"Windows\",\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_49ffb1eb21cc425681653678911d6f84\",\r\n \ \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinescalesvirtualmachinescaleseOS__1_889c6e8a34cf4935b8b8af7a599b5d4b\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinescalesvirtualmachinescaleseOS__1_49ffb1eb21cc425681653678911d6f84\"\r\n \ },\r\n \"diskSizeGB\": 512\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"testPC000001\",\r\n \ \"adminUsername\": \"testuser\",\r\n \"windowsConfiguration\": @@ -877,7 +784,7 @@ interactions: \ \"provisioningState\": \"Updating\"\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/dac9f666-64b9-4efc-9096-6f71754717fb?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/55570a4f-ad8c-4721-a9a6-3bbe861222f4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -885,7 +792,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:18:17 GMT + - Thu, 06 Jan 2022 08:13:54 GMT expires: - '-1' pragma: @@ -904,7 +811,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/VMScaleSetActions3Min;239,Microsoft.Compute/VMScaleSetActions30Min;1197,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1192' + - '1193' x-ms-request-charge: - '0' status: @@ -920,24 +827,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/dac9f666-64b9-4efc-9096-6f71754717fb?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/55570a4f-ad8c-4721-a9a6-3bbe861222f4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:18:17.1075455+00:00\",\r\n \"endTime\": - \"2021-10-12T07:18:17.2481443+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"dac9f666-64b9-4efc-9096-6f71754717fb\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:13:54.553542+00:00\",\r\n \"endTime\": + \"2022-01-06T08:13:54.6941356+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"55570a4f-ad8c-4721-a9a6-3bbe861222f4\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '183' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:18:47 GMT + - Thu, 06 Jan 2022 08:14:25 GMT expires: - '-1' pragma: @@ -954,7 +861,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29893 + - Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29936 status: code: 200 message: OK @@ -968,7 +875,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1?api-version=2021-07-01 @@ -981,15 +888,15 @@ interactions: \ \"name\": \"Standard_D1_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \ \"properties\": {\r\n \"latestModelApplied\": true,\r\n \"modelDefinitionApplied\": \"VirtualMachineScaleSet\",\r\n \"networkProfileConfiguration\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamex8c68120d/subnets/subnetnamex8c68120d\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]},\r\n - \ \"vmId\": \"66b7eecb-159b-497a-aad6-5b2ceae62e36\",\r\n \"hardwareProfile\": + \ \"vmId\": \"0399d252-0f14-4162-ad43-0a7a5d02e43a\",\r\n \"hardwareProfile\": {},\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2016-Datacenter\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": - \"14393.4651.2109130103\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": - \"Windows\",\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_889c6e8a34cf4935b8b8af7a599b5d4b\",\r\n + \"14393.4906.2112080838\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"Windows\",\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_49ffb1eb21cc425681653678911d6f84\",\r\n \ \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Standard_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinescalesvirtualmachinescaleseOS__1_889c6e8a34cf4935b8b8af7a599b5d4b\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/disks/virtualmachinescalesvirtualmachinescaleseOS__1_49ffb1eb21cc425681653678911d6f84\"\r\n \ },\r\n \"diskSizeGB\": 512\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"testPC000001\",\r\n \ \"adminUsername\": \"testuser\",\r\n \"windowsConfiguration\": @@ -1006,7 +913,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:18:47 GMT + - Thu, 06 Jan 2022 08:14:25 GMT expires: - '-1' pragma: @@ -1041,7 +948,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1/restart?api-version=2021-07-01 @@ -1050,17 +957,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/24b70ab8-609c-411d-957d-782e0400eaaf?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/bfb2a22f-33c0-4cb9-b971-7a951ab6a134?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:18:47 GMT + - Thu, 06 Jan 2022 08:14:25 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/24b70ab8-609c-411d-957d-782e0400eaaf?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/bfb2a22f-33c0-4cb9-b971-7a951ab6a134?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1071,9 +978,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1196,Microsoft.Compute/VMScaleSetVMActions3Min;199,Microsoft.Compute/VMScaleSetVMActions30Min;999,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3725,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1196,Microsoft.Compute/VMScaleSetVMActions3Min;199,Microsoft.Compute/VMScaleSetVMActions30Min;999,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3728,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1188' + - '1186' x-ms-request-charge: - '1' status: @@ -1089,15 +996,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/24b70ab8-609c-411d-957d-782e0400eaaf?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/bfb2a22f-33c0-4cb9-b971-7a951ab6a134?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:18:48.4044947+00:00\",\r\n \"endTime\": - \"2021-10-12T07:18:49.7482743+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"24b70ab8-609c-411d-957d-782e0400eaaf\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:14:25.6160651+00:00\",\r\n \"endTime\": + \"2022-01-06T08:14:26.9285246+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"bfb2a22f-33c0-4cb9-b971-7a951ab6a134\"\r\n}" headers: cache-control: - no-cache @@ -1106,7 +1013,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:19:18 GMT + - Thu, 06 Jan 2022 08:14:55 GMT expires: - '-1' pragma: @@ -1123,7 +1030,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29889 + - Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29934 status: code: 200 message: OK @@ -1137,10 +1044,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/24b70ab8-609c-411d-957d-782e0400eaaf?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/bfb2a22f-33c0-4cb9-b971-7a951ab6a134?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1150,7 +1057,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:19:18 GMT + - Thu, 06 Jan 2022 08:14:55 GMT expires: - '-1' pragma: @@ -1163,7 +1070,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14993,Microsoft.Compute/GetOperation30Min;29888 + - Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29933 status: code: 200 message: OK @@ -1179,7 +1086,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1/poweroff?skipShutdown=false&api-version=2021-07-01 @@ -1188,17 +1095,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/eab46c7d-4275-4d39-a75a-ab5be2d17ee8?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3f540bc0-725e-4fdb-96d2-a29eaeeecdf0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:19:19 GMT + - Thu, 06 Jan 2022 08:14:55 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/eab46c7d-4275-4d39-a75a-ab5be2d17ee8?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3f540bc0-725e-4fdb-96d2-a29eaeeecdf0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1209,9 +1116,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteVMScaleSetVM3Min;239,Microsoft.Compute/DeleteVMScaleSetVM30Min;1199,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3724,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/DeleteVMScaleSetVM3Min;239,Microsoft.Compute/DeleteVMScaleSetVM30Min;1199,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3727,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1187' + - '1185' x-ms-request-charge: - '1' status: @@ -1227,15 +1134,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/eab46c7d-4275-4d39-a75a-ab5be2d17ee8?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3f540bc0-725e-4fdb-96d2-a29eaeeecdf0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:19:19.1390366+00:00\",\r\n \"endTime\": - \"2021-10-12T07:19:39.5297456+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"eab46c7d-4275-4d39-a75a-ab5be2d17ee8\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:14:55.8817909+00:00\",\r\n \"endTime\": + \"2022-01-06T08:15:09.4757135+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"3f540bc0-725e-4fdb-96d2-a29eaeeecdf0\"\r\n}" headers: cache-control: - no-cache @@ -1244,7 +1151,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:19:49 GMT + - Thu, 06 Jan 2022 08:15:26 GMT expires: - '-1' pragma: @@ -1261,7 +1168,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29883 + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29931 status: code: 200 message: OK @@ -1275,10 +1182,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/eab46c7d-4275-4d39-a75a-ab5be2d17ee8?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3f540bc0-725e-4fdb-96d2-a29eaeeecdf0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1288,7 +1195,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:19:49 GMT + - Thu, 06 Jan 2022 08:15:26 GMT expires: - '-1' pragma: @@ -1301,7 +1208,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14987,Microsoft.Compute/GetOperation30Min;29882 + - Microsoft.Compute/GetOperation3Min;14993,Microsoft.Compute/GetOperation30Min;29930 status: code: 200 message: OK @@ -1317,7 +1224,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1/start?api-version=2021-07-01 @@ -1326,17 +1233,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/60aa2498-873e-4ad9-9827-a7455ee7e38b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5ccace73-86a0-430b-9267-fd8083af3f52?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:19:49 GMT + - Thu, 06 Jan 2022 08:15:26 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/60aa2498-873e-4ad9-9827-a7455ee7e38b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5ccace73-86a0-430b-9267-fd8083af3f52?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1347,9 +1254,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/VMScaleSetActions3Min;237,Microsoft.Compute/VMScaleSetActions30Min;1195,Microsoft.Compute/VMScaleSetVMActions3Min;198,Microsoft.Compute/VMScaleSetVMActions30Min;998,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3724,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/VMScaleSetActions3Min;237,Microsoft.Compute/VMScaleSetActions30Min;1195,Microsoft.Compute/VMScaleSetVMActions3Min;198,Microsoft.Compute/VMScaleSetVMActions30Min;998,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3726,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1186' + - '1184' x-ms-request-charge: - '1' status: @@ -1365,24 +1272,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/60aa2498-873e-4ad9-9827-a7455ee7e38b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5ccace73-86a0-430b-9267-fd8083af3f52?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:19:49.6548068+00:00\",\r\n \"endTime\": - \"2021-10-12T07:19:59.0142505+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"60aa2498-873e-4ad9-9827-a7455ee7e38b\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:15:26.21011+00:00\",\r\n \"endTime\": + \"2022-01-06T08:15:31.8819985+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"5ccace73-86a0-430b-9267-fd8083af3f52\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '182' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:20:19 GMT + - Thu, 06 Jan 2022 08:15:55 GMT expires: - '-1' pragma: @@ -1399,7 +1306,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14980,Microsoft.Compute/GetOperation30Min;29887 + - Microsoft.Compute/GetOperation3Min;14991,Microsoft.Compute/GetOperation30Min;29928 status: code: 200 message: OK @@ -1413,10 +1320,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/60aa2498-873e-4ad9-9827-a7455ee7e38b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/5ccace73-86a0-430b-9267-fd8083af3f52?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1426,7 +1333,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:20:19 GMT + - Thu, 06 Jan 2022 08:15:55 GMT expires: - '-1' pragma: @@ -1439,7 +1346,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14979,Microsoft.Compute/GetOperation30Min;29886 + - Microsoft.Compute/GetOperation3Min;14990,Microsoft.Compute/GetOperation30Min;29927 status: code: 200 message: OK @@ -1457,7 +1364,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1/runCommand?api-version=2021-07-01 @@ -1466,17 +1373,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/519ef805-56e2-4649-844d-49f1fbfd9fa4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1370a8d1-baee-4a09-8064-8a91f7e3cd1f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:20:19 GMT + - Thu, 06 Jan 2022 08:15:55 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/519ef805-56e2-4649-844d-49f1fbfd9fa4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1370a8d1-baee-4a09-8064-8a91f7e3cd1f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1489,7 +1396,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/VMScaleSetActions3Min;236,Microsoft.Compute/VMScaleSetActions30Min;1194,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3725,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1185' + - '1183' x-ms-request-charge: - '1' status: @@ -1505,61 +1412,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/519ef805-56e2-4649-844d-49f1fbfd9fa4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 - response: - body: - string: "{\r\n \"startTime\": \"2021-10-12T07:20:20.1237743+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"519ef805-56e2-4649-844d-49f1fbfd9fa4\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '134' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 12 Oct 2021 07:20:49 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14975,Microsoft.Compute/GetOperation30Min;29882 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/519ef805-56e2-4649-844d-49f1fbfd9fa4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1370a8d1-baee-4a09-8064-8a91f7e3cd1f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:20:20.1237743+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"519ef805-56e2-4649-844d-49f1fbfd9fa4\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:15:56.4132852+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"1370a8d1-baee-4a09-8064-8a91f7e3cd1f\"\r\n}" headers: cache-control: - no-cache @@ -1568,7 +1428,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:21:20 GMT + - Thu, 06 Jan 2022 08:16:25 GMT expires: - '-1' pragma: @@ -1585,7 +1445,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14969,Microsoft.Compute/GetOperation30Min;29876 + - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29925 status: code: 200 message: OK @@ -1599,26 +1459,29 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/519ef805-56e2-4649-844d-49f1fbfd9fa4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1370a8d1-baee-4a09-8064-8a91f7e3cd1f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:20:20.1237743+00:00\",\r\n \"endTime\": - \"2021-10-12T07:21:30.7635767+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"properties\": {\r\n \"output\": {\"value\":[{\"code\":\"ComponentStatus/StdOut/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning - succeeded\",\"message\":\"This is a sample script with parameters \"},{\"code\":\"ComponentStatus/StdErr/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning - succeeded\",\"message\":\"\"}]}\r\n },\r\n \"name\": \"519ef805-56e2-4649-844d-49f1fbfd9fa4\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:15:56.4132852+00:00\",\r\n \"endTime\": + \"2022-01-06T08:16:46.8977044+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"properties\": {\r\n \"output\": {\r\n \"value\": [\r\n {\r\n \"code\": + \"ComponentStatus/StdOut/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": + \"Provisioning succeeded\",\r\n \"message\": \"This is a sample script + with parameters \"\r\n },\r\n {\r\n \"code\": \"ComponentStatus/StdErr/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n + \ \"message\": \"\"\r\n }\r\n ]\r\n}\r\n },\r\n \"name\": \"1370a8d1-baee-4a09-8064-8a91f7e3cd1f\"\r\n}" headers: cache-control: - no-cache content-length: - - '503' + - '610' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:21:50 GMT + - Thu, 06 Jan 2022 08:16:56 GMT expires: - '-1' pragma: @@ -1635,7 +1498,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14967,Microsoft.Compute/GetOperation30Min;29872 + - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29922 status: code: 200 message: OK @@ -1649,10 +1512,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/519ef805-56e2-4649-844d-49f1fbfd9fa4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1370a8d1-baee-4a09-8064-8a91f7e3cd1f?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '{"value":[{"code":"ComponentStatus/StdOut/succeeded","level":"Info","displayStatus":"Provisioning @@ -1666,7 +1529,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:21:50 GMT + - Thu, 06 Jan 2022 08:16:56 GMT expires: - '-1' pragma: @@ -1683,7 +1546,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14966,Microsoft.Compute/GetOperation30Min;29871 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29921 status: code: 200 message: OK @@ -1701,7 +1564,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/manualupgrade?api-version=2021-07-01 @@ -1710,17 +1573,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3dbb98e4-04f9-49fc-88d2-efd4bd677303?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2b4a8812-2546-4a17-adda-6e052ddfa92a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:21:50 GMT + - Thu, 06 Jan 2022 08:16:56 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3dbb98e4-04f9-49fc-88d2-efd4bd677303?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2b4a8812-2546-4a17-adda-6e052ddfa92a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1731,9 +1594,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/VMScaleSetActions3Min;237,Microsoft.Compute/VMScaleSetActions30Min;1193,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/VMScaleSetActions3Min;236,Microsoft.Compute/VMScaleSetActions30Min;1193,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1184' + - '1182' x-ms-request-charge: - '0' status: @@ -1749,15 +1612,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3dbb98e4-04f9-49fc-88d2-efd4bd677303?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2b4a8812-2546-4a17-adda-6e052ddfa92a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:21:51.2015887+00:00\",\r\n \"endTime\": - \"2021-10-12T07:21:51.3265661+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"3dbb98e4-04f9-49fc-88d2-efd4bd677303\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:16:56.7102314+00:00\",\r\n \"endTime\": + \"2022-01-06T08:16:56.8664661+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"2b4a8812-2546-4a17-adda-6e052ddfa92a\"\r\n}" headers: cache-control: - no-cache @@ -1766,7 +1629,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:22:20 GMT + - Thu, 06 Jan 2022 08:17:26 GMT expires: - '-1' pragma: @@ -1783,7 +1646,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14965,Microsoft.Compute/GetOperation30Min;29865 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29918 status: code: 200 message: OK @@ -1797,10 +1660,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/3dbb98e4-04f9-49fc-88d2-efd4bd677303?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2b4a8812-2546-4a17-adda-6e052ddfa92a?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1810,7 +1673,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:22:20 GMT + - Thu, 06 Jan 2022 08:17:26 GMT expires: - '-1' pragma: @@ -1823,7 +1686,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14964,Microsoft.Compute/GetOperation30Min;29864 + - Microsoft.Compute/GetOperation3Min;14981,Microsoft.Compute/GetOperation30Min;29917 status: code: 200 message: OK @@ -1839,7 +1702,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1/deallocate?api-version=2021-07-01 @@ -1848,17 +1711,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/75fd5939-d87c-4dc0-8b68-bd823cef799c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/6df2b18c-94b9-4846-8342-3525b598ad13?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:22:20 GMT + - Thu, 06 Jan 2022 08:17:26 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/75fd5939-d87c-4dc0-8b68-bd823cef799c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/6df2b18c-94b9-4846-8342-3525b598ad13?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1869,9 +1732,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteVMScaleSetVM3Min;239,Microsoft.Compute/DeleteVMScaleSetVM30Min;1198,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3721,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/DeleteVMScaleSetVM3Min;238,Microsoft.Compute/DeleteVMScaleSetVM30Min;1198,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3724,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1183' + - '1181' x-ms-request-charge: - '1' status: @@ -1887,14 +1750,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/75fd5939-d87c-4dc0-8b68-bd823cef799c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/6df2b18c-94b9-4846-8342-3525b598ad13?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:22:21.7025174+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"75fd5939-d87c-4dc0-8b68-bd823cef799c\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:17:26.9758302+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"6df2b18c-94b9-4846-8342-3525b598ad13\"\r\n}" headers: cache-control: - no-cache @@ -1903,7 +1766,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:22:51 GMT + - Thu, 06 Jan 2022 08:17:56 GMT expires: - '-1' pragma: @@ -1920,7 +1783,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14969,Microsoft.Compute/GetOperation30Min;29862 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29915 status: code: 200 message: OK @@ -1934,15 +1797,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/75fd5939-d87c-4dc0-8b68-bd823cef799c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/6df2b18c-94b9-4846-8342-3525b598ad13?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:22:21.7025174+00:00\",\r\n \"endTime\": - \"2021-10-12T07:22:56.2809221+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"75fd5939-d87c-4dc0-8b68-bd823cef799c\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:17:26.9758302+00:00\",\r\n \"endTime\": + \"2022-01-06T08:18:02.2102352+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"6df2b18c-94b9-4846-8342-3525b598ad13\"\r\n}" headers: cache-control: - no-cache @@ -1951,7 +1814,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:23:21 GMT + - Thu, 06 Jan 2022 08:18:26 GMT expires: - '-1' pragma: @@ -1968,7 +1831,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14973,Microsoft.Compute/GetOperation30Min;29859 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29912 status: code: 200 message: OK @@ -1982,10 +1845,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/75fd5939-d87c-4dc0-8b68-bd823cef799c?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/6df2b18c-94b9-4846-8342-3525b598ad13?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1995,7 +1858,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:23:21 GMT + - Thu, 06 Jan 2022 08:18:26 GMT expires: - '-1' pragma: @@ -2008,7 +1871,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14972,Microsoft.Compute/GetOperation30Min;29858 + - Microsoft.Compute/GetOperation3Min;14981,Microsoft.Compute/GetOperation30Min;29911 status: code: 200 message: OK @@ -2026,7 +1889,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/delete?api-version=2021-07-01 @@ -2035,17 +1898,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/123473ef-7570-4ac2-b41a-02d3b3f01773?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/538e35d6-2afa-4c28-83d3-8eab8986e9ae?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:23:21 GMT + - Thu, 06 Jan 2022 08:18:26 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/123473ef-7570-4ac2-b41a-02d3b3f01773?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/538e35d6-2afa-4c28-83d3-8eab8986e9ae?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2056,9 +1919,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1192,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3721,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/VMScaleSetActions3Min;237,Microsoft.Compute/VMScaleSetActions30Min;1192,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3723,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1182' + - '1180' x-ms-request-charge: - '1' status: @@ -2074,15 +1937,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/123473ef-7570-4ac2-b41a-02d3b3f01773?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/538e35d6-2afa-4c28-83d3-8eab8986e9ae?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:23:22.3279559+00:00\",\r\n \"endTime\": - \"2021-10-12T07:23:24.0936466+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"123473ef-7570-4ac2-b41a-02d3b3f01773\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:18:27.2884092+00:00\",\r\n \"endTime\": + \"2022-01-06T08:18:29.1008853+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"538e35d6-2afa-4c28-83d3-8eab8986e9ae\"\r\n}" headers: cache-control: - no-cache @@ -2091,7 +1954,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:23:51 GMT + - Thu, 06 Jan 2022 08:18:57 GMT expires: - '-1' pragma: @@ -2108,7 +1971,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14976,Microsoft.Compute/GetOperation30Min;29856 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29909 status: code: 200 message: OK @@ -2122,10 +1985,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/123473ef-7570-4ac2-b41a-02d3b3f01773?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/538e35d6-2afa-4c28-83d3-8eab8986e9ae?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -2135,7 +1998,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:23:51 GMT + - Thu, 06 Jan 2022 08:18:57 GMT expires: - '-1' pragma: @@ -2148,7 +2011,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14975,Microsoft.Compute/GetOperation30Min;29855 + - Microsoft.Compute/GetOperation3Min;14981,Microsoft.Compute/GetOperation30Min;29908 status: code: 200 message: OK @@ -2164,7 +2027,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d/virtualmachines/1?api-version=2021-07-01 @@ -2173,17 +2036,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/80537f78-4a2c-4b6c-8f1d-2867e3118b51?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c7f1055f-bb6c-4338-8e31-3440333834c1?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:23:52 GMT + - Thu, 06 Jan 2022 08:18:57 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/80537f78-4a2c-4b6c-8f1d-2867e3118b51?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c7f1055f-bb6c-4338-8e31-3440333834c1?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2196,7 +2059,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/DeleteVMScaleSetVM3Min;238,Microsoft.Compute/DeleteVMScaleSetVM30Min;1197,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-deletes: - - '14991' + - '14993' x-ms-request-charge: - '0' status: @@ -2212,15 +2075,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/80537f78-4a2c-4b6c-8f1d-2867e3118b51?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c7f1055f-bb6c-4338-8e31-3440333834c1?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:23:52.8594314+00:00\",\r\n \"endTime\": - \"2021-10-12T07:23:52.9376315+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"80537f78-4a2c-4b6c-8f1d-2867e3118b51\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:18:57.5071501+00:00\",\r\n \"endTime\": + \"2022-01-06T08:18:57.6008887+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"c7f1055f-bb6c-4338-8e31-3440333834c1\"\r\n}" headers: cache-control: - no-cache @@ -2229,7 +2092,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:22 GMT + - Thu, 06 Jan 2022 08:19:27 GMT expires: - '-1' pragma: @@ -2246,7 +2109,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14979,Microsoft.Compute/GetOperation30Min;29853 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29906 status: code: 200 message: OK @@ -2262,7 +2125,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescaleset8c68120d?api-version=2021-07-01 @@ -2273,17 +2136,17 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/15298434-81e1-4689-9cc9-8c810d213d37?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c1842068-7cc4-4345-8039-c9294e07aa77?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:24:23 GMT + - Thu, 06 Jan 2022 08:19:27 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/15298434-81e1-4689-9cc9-8c810d213d37?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c1842068-7cc4-4345-8039-c9294e07aa77?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -2296,7 +2159,7 @@ interactions: x-ms-ratelimit-remaining-resource: - Microsoft.Compute/DeleteVMScaleSet3Min;79,Microsoft.Compute/DeleteVMScaleSet30Min;398,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-deletes: - - '14990' + - '14992' x-ms-request-charge: - '0' status: @@ -2312,15 +2175,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/15298434-81e1-4689-9cc9-8c810d213d37?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/c1842068-7cc4-4345-8039-c9294e07aa77?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:24:23.3283506+00:00\",\r\n \"endTime\": - \"2021-10-12T07:24:23.4221017+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"15298434-81e1-4689-9cc9-8c810d213d37\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:19:27.6946488+00:00\",\r\n \"endTime\": + \"2022-01-06T08:19:27.7884771+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"c1842068-7cc4-4345-8039-c9294e07aa77\"\r\n}" headers: cache-control: - no-cache @@ -2329,7 +2192,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:33 GMT + - Thu, 06 Jan 2022 08:19:37 GMT expires: - '-1' pragma: @@ -2346,7 +2209,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14980,Microsoft.Compute/GetOperation30Min;29851 + - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29905 status: code: 200 message: OK diff --git a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm_2.yaml b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm_2.yaml index 6ff0bc311adf..e6b6ce9ad4fd 100644 --- a/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm_2.yaml +++ b/sdk/compute/azure-mgmt-compute/tests/recordings/test_mgmt_compute_vmss.test_compute_vmss_vm_2.yaml @@ -14,17 +14,17 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamexb172129e\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e\",\r\n - \ \"etag\": \"W/\\\"fa5f2673-e6da-4b28-8375-af7af1407ce7\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"0afc93ef-8e4e-4eeb-ab85-d9158dec5058\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"6af28632-636c-4071-aba3-b140b797693e\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"5f213485-6478-46d3-876a-c1f3c9c027cc\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -32,7 +32,7 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/44e2a769-7756-4a72-9908-fbf5c4633bc7?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/3984b7ea-1f41-4b31-bf69-e5775fc294dc?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -40,7 +40,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:37 GMT + - Thu, 06 Jan 2022 08:19:40 GMT expires: - '-1' pragma: @@ -53,9 +53,9 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - d7f83c22-e08f-4e74-b230-fd772d083030 + - c910a401-4dce-4771-84e6-97a3318f23e9 x-ms-ratelimit-remaining-subscription-writes: - - '1187' + - '1180' status: code: 201 message: Created @@ -69,10 +69,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/44e2a769-7756-4a72-9908-fbf5c4633bc7?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/3984b7ea-1f41-4b31-bf69-e5775fc294dc?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -84,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:40 GMT + - Thu, 06 Jan 2022 08:19:43 GMT expires: - '-1' pragma: @@ -101,7 +101,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 4f9ef906-a1e4-40bf-aee4-c517b4518f3a + - b04f71eb-ecd4-48d9-9684-53627a53178d status: code: 200 message: OK @@ -115,17 +115,17 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"networknamexb172129e\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e\",\r\n - \ \"etag\": \"W/\\\"a5d3e35f-b55f-4783-b555-6d8ef717ee3d\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"bc02721c-9777-4b04-83c8-d7ebb44a784e\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"6af28632-636c-4071-aba3-b140b797693e\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": + \"5f213485-6478-46d3-876a-c1f3c9c027cc\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [],\r\n \ \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false\r\n \ }\r\n}" @@ -137,9 +137,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:40 GMT + - Thu, 06 Jan 2022 08:19:43 GMT etag: - - W/"a5d3e35f-b55f-4783-b555-6d8ef717ee3d" + - W/"bc02721c-9777-4b04-83c8-d7ebb44a784e" expires: - '-1' pragma: @@ -156,7 +156,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - e0728213-4d00-4ffe-b085-7df4cd00ba0b + - 8f9f483e-cb44-441b-b8fc-2a890d7d00d9 status: code: 200 message: OK @@ -174,21 +174,21 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetnamexb172129e\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e\",\r\n - \ \"etag\": \"W/\\\"4dc852c7-e55c-4812-87f4-3799344bb4b6\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"c6a0fcf3-6a87-4e8b-9672-744528e33541\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/35587f53-18ec-4723-a390-25e1ecd12311?api-version=2021-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/bcc523a1-ae32-4853-82fd-2e477b7e9e76?api-version=2021-05-01 cache-control: - no-cache content-length: @@ -196,7 +196,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:40 GMT + - Thu, 06 Jan 2022 08:19:43 GMT expires: - '-1' pragma: @@ -209,9 +209,9 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - c67bb8a4-fff5-4a6d-8a54-d480a365f6ad + - 15479929-7ce1-4b80-b17f-2c0694022599 x-ms-ratelimit-remaining-subscription-writes: - - '1186' + - '1179' status: code: 201 message: Created @@ -225,10 +225,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/35587f53-18ec-4723-a390-25e1ecd12311?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/bcc523a1-ae32-4853-82fd-2e477b7e9e76?api-version=2021-05-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -240,7 +240,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:44 GMT + - Thu, 06 Jan 2022 08:19:46 GMT expires: - '-1' pragma: @@ -257,7 +257,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 6e01ebdd-9ea4-4a6c-99fa-ba2066a8db58 + - 248ef18f-451e-48f2-8945-b56eff78cbed status: code: 200 message: OK @@ -271,14 +271,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-network/19.3.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e?api-version=2021-05-01 response: body: string: "{\r\n \"name\": \"subnetnamexb172129e\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e\",\r\n - \ \"etag\": \"W/\\\"a15a277a-00b0-492a-9d74-1851a9ce4a6d\\\"\",\r\n \"properties\": + \ \"etag\": \"W/\\\"4318b1fa-ff8d-48fa-a290-960f1f5dfcbb\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \ \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \ \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": @@ -291,9 +291,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:44 GMT + - Thu, 06 Jan 2022 08:19:46 GMT etag: - - W/"a15a277a-00b0-492a-9d74-1851a9ce4a6d" + - W/"4318b1fa-ff8d-48fa-a290-960f1f5dfcbb" expires: - '-1' pragma: @@ -310,7 +310,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 868eb776-c7be-4e49-9fdf-09bc91303159 + - 653d364a-22b8-4e95-8be1-d5e6e4659fcc status: code: 200 message: OK @@ -338,7 +338,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetb172129e?api-version=2021-07-01 @@ -363,12 +363,12 @@ interactions: \"latest\"\r\n }\r\n },\r\n \"networkProfile\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]}\r\n \ },\r\n \"provisioningState\": \"Creating\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": - \"b4d76034-2c47-45db-8fb6-3a6fbf039d8e\"\r\n }\r\n}" + \"e1dbbaca-1a06-48cd-9f6b-7e57868313f0\"\r\n }\r\n}" headers: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8501a54a-c605-4c12-af0d-2f3b3aa84d48?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1a686daf-e392-4037-a2a7-91f6417ab86b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: @@ -376,7 +376,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:48 GMT + - Thu, 06 Jan 2022 08:19:48 GMT expires: - '-1' pragma: @@ -389,9 +389,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/CreateVMScaleSet3Min;185,Microsoft.Compute/CreateVMScaleSet30Min;928,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3721,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/CreateVMScaleSet3Min;185,Microsoft.Compute/CreateVMScaleSet30Min;929,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3723,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - - '1194' + - '1193' x-ms-request-charge: - '2' status: @@ -407,14 +407,61 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1a686daf-e392-4037-a2a7-91f6417ab86b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2022-01-06T08:19:48.2727854+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"1a686daf-e392-4037-a2a7-91f6417ab86b\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 06 Jan 2022 08:19:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29904 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8501a54a-c605-4c12-af0d-2f3b3aa84d48?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1a686daf-e392-4037-a2a7-91f6417ab86b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:24:46.7972269+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"8501a54a-c605-4c12-af0d-2f3b3aa84d48\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:19:48.2727854+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"1a686daf-e392-4037-a2a7-91f6417ab86b\"\r\n}" headers: cache-control: - no-cache @@ -423,7 +470,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:24:58 GMT + - Thu, 06 Jan 2022 08:21:35 GMT expires: - '-1' pragma: @@ -440,7 +487,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14979,Microsoft.Compute/GetOperation30Min;29850 + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29912 status: code: 200 message: OK @@ -454,15 +501,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/8501a54a-c605-4c12-af0d-2f3b3aa84d48?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/1a686daf-e392-4037-a2a7-91f6417ab86b?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:24:46.7972269+00:00\",\r\n \"endTime\": - \"2021-10-12T07:26:05.7821092+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"8501a54a-c605-4c12-af0d-2f3b3aa84d48\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:19:48.2727854+00:00\",\r\n \"endTime\": + \"2022-01-06T08:21:39.2572291+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"1a686daf-e392-4037-a2a7-91f6417ab86b\"\r\n}" headers: cache-control: - no-cache @@ -471,7 +518,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:26:36 GMT + - Thu, 06 Jan 2022 08:22:05 GMT expires: - '-1' pragma: @@ -488,7 +535,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14993,Microsoft.Compute/GetOperation30Min;29871 + - Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29910 status: code: 200 message: OK @@ -502,7 +549,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetb172129e?api-version=2021-07-01 @@ -527,7 +574,7 @@ interactions: \"latest\"\r\n }\r\n },\r\n \"networkProfile\": {\"networkInterfaceConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"primary\":true,\"enableAcceleratedNetworking\":false,\"dnsSettings\":{\"dnsServers\":[]},\"enableIPForwarding\":false,\"ipConfigurations\":[{\"name\":\"testPC\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/networknamexb172129e/subnets/subnetnamexb172129e\"},\"privateIPAddressVersion\":\"IPv4\"}}]}}]}\r\n \ },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": - \"b4d76034-2c47-45db-8fb6-3a6fbf039d8e\"\r\n }\r\n}" + \"e1dbbaca-1a06-48cd-9f6b-7e57868313f0\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -536,7 +583,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:26:36 GMT + - Thu, 06 Jan 2022 08:22:05 GMT expires: - '-1' pragma: @@ -553,7 +600,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetVMScaleSet3Min;396,Microsoft.Compute/GetVMScaleSet30Min;2582 + - Microsoft.Compute/GetVMScaleSet3Min;394,Microsoft.Compute/GetVMScaleSet30Min;2579 status: code: 200 message: OK @@ -567,40 +614,39 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetb172129e/virtualmachines/0/instanceView?api-version=2021-07-01 response: body: - string: "{\r\n \"placementGroupId\": \"1bf751cd-29b7-47d1-89fc-93fd95946ce8\",\r\n + string: "{\r\n \"placementGroupId\": \"ba761276-f1fc-49e4-80f2-e7c0a1aa8860\",\r\n \ \"platformUpdateDomain\": 0,\r\n \"platformFaultDomain\": 0,\r\n \"computerName\": \"testPC000000\",\r\n \"osName\": \"Windows Server 2016 Datacenter\",\r\n - \ \"osVersion\": \"Windows:Windows Server 2016 Datacenter-10.0.14393.4651\",\r\n - \ \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.7.41491.1024\",\r\n \"statuses\": - [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": - \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": - \"GuestAgent is running and processing the extensions.\",\r\n \"time\": - \"2021-10-12T07:28:35+00:00\"\r\n }\r\n ]\r\n },\r\n \"disks\": - [\r\n {\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_e65a0769271e4babbfa0a29b9666593b\",\r\n + \ \"osVersion\": \"10.0.14393.4825\",\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": + \"2.7.41491.1032\",\r\n \"statuses\": [\r\n {\r\n \"code\": + \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": + \"Ready\",\r\n \"message\": \"GuestAgent is running and processing + the extensions.\",\r\n \"time\": \"2022-01-06T08:24:45.781+00:00\"\r\n + \ }\r\n ]\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": \"virtualmachinescalesvirtualmachinescaleseOS__1_65952147be264cbd9fbf3df0e33f028d\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-10-12T07:26:06.4228649+00:00\"\r\n + succeeded\",\r\n \"time\": \"2022-01-06T08:21:39.8197555+00:00\"\r\n \ }\r\n ]\r\n }\r\n ],\r\n \"hyperVGeneration\": \"V1\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n - \ \"time\": \"2021-10-12T07:26:49.7042534+00:00\"\r\n },\r\n {\r\n + \ \"time\": \"2022-01-06T08:22:55.5231064+00:00\"\r\n },\r\n {\r\n \ \"code\": \"PowerState/running\",\r\n \"level\": \"Info\",\r\n \ \"displayStatus\": \"VM running\"\r\n }\r\n ]\r\n}" headers: cache-control: - no-cache content-length: - - '1339' + - '1304' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:29:36 GMT + - Thu, 06 Jan 2022 08:25:05 GMT expires: - '-1' pragma: @@ -635,7 +681,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetb172129e/virtualmachines/0/redeploy?api-version=2021-07-01 @@ -644,17 +690,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f708a7c8-b365-428b-bfc1-e1c6e5fcee73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:29:36 GMT + - Thu, 06 Jan 2022 08:25:05 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f708a7c8-b365-428b-bfc1-e1c6e5fcee73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -665,7 +711,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/VMScaleSetActions3Min;239,Microsoft.Compute/VMScaleSetActions30Min;1191,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3725,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/VMScaleSetActions3Min;239,Microsoft.Compute/VMScaleSetActions30Min;1191,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3728,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - '1181' x-ms-request-charge: @@ -683,14 +729,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f708a7c8-b365-428b-bfc1-e1c6e5fcee73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:29:37.1272597+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"f708a7c8-b365-428b-bfc1-e1c6e5fcee73\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:25:06.2413445+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4\"\r\n}" headers: cache-control: - no-cache @@ -699,7 +745,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:30:06 GMT + - Thu, 06 Jan 2022 08:25:35 GMT expires: - '-1' pragma: @@ -716,7 +762,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29918 + - Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29933 status: code: 200 message: OK @@ -730,14 +776,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f708a7c8-b365-428b-bfc1-e1c6e5fcee73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:29:37.1272597+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"f708a7c8-b365-428b-bfc1-e1c6e5fcee73\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:25:06.2413445+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4\"\r\n}" headers: cache-control: - no-cache @@ -746,7 +792,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:30:37 GMT + - Thu, 06 Jan 2022 08:26:06 GMT expires: - '-1' pragma: @@ -763,7 +809,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29915 + - Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29930 status: code: 200 message: OK @@ -777,14 +823,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f708a7c8-b365-428b-bfc1-e1c6e5fcee73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:29:37.1272597+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"f708a7c8-b365-428b-bfc1-e1c6e5fcee73\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:25:06.2413445+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4\"\r\n}" headers: cache-control: - no-cache @@ -793,7 +839,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:31:07 GMT + - Thu, 06 Jan 2022 08:26:36 GMT expires: - '-1' pragma: @@ -810,7 +856,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14992,Microsoft.Compute/GetOperation30Min;29912 + - Microsoft.Compute/GetOperation3Min;14992,Microsoft.Compute/GetOperation30Min;29927 status: code: 200 message: OK @@ -824,15 +870,62 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f708a7c8-b365-428b-bfc1-e1c6e5fcee73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:29:37.1272597+00:00\",\r\n \"endTime\": - \"2021-10-12T07:31:29.4403013+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"f708a7c8-b365-428b-bfc1-e1c6e5fcee73\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:25:06.2413445+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 06 Jan 2022 08:27:06 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14989,Microsoft.Compute/GetOperation30Min;29924 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2022-01-06T08:25:06.2413445+00:00\",\r\n \"endTime\": + \"2022-01-06T08:27:20.4757484+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4\"\r\n}" headers: cache-control: - no-cache @@ -841,7 +934,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:31:37 GMT + - Thu, 06 Jan 2022 08:27:35 GMT expires: - '-1' pragma: @@ -858,7 +951,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14989,Microsoft.Compute/GetOperation30Min;29909 + - Microsoft.Compute/GetOperation3Min;14986,Microsoft.Compute/GetOperation30Min;29921 status: code: 200 message: OK @@ -872,10 +965,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/f708a7c8-b365-428b-bfc1-e1c6e5fcee73?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/608fb9ca-a8b4-4799-9ed1-8c61d4e1b9e4?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -885,7 +978,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:31:37 GMT + - Thu, 06 Jan 2022 08:27:35 GMT expires: - '-1' pragma: @@ -898,7 +991,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14988,Microsoft.Compute/GetOperation30Min;29908 + - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29920 status: code: 200 message: OK @@ -916,7 +1009,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetb172129e/virtualmachines/0/reimage?api-version=2021-07-01 @@ -925,17 +1018,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/646931b8-58da-4800-8be6-21a6c0b334fd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/190d3f6d-9dd2-4aee-865b-d85385304884?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:31:37 GMT + - Thu, 06 Jan 2022 08:27:36 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/646931b8-58da-4800-8be6-21a6c0b334fd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/190d3f6d-9dd2-4aee-865b-d85385304884?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -946,7 +1039,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1190,Microsoft.Compute/VMScaleSetVMActions3Min;199,Microsoft.Compute/VMScaleSetVMActions30Min;997,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3724,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1190,Microsoft.Compute/VMScaleSetVMActions3Min;199,Microsoft.Compute/VMScaleSetVMActions30Min;997,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3727,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - '1180' x-ms-request-charge: @@ -964,23 +1057,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/646931b8-58da-4800-8be6-21a6c0b334fd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/190d3f6d-9dd2-4aee-865b-d85385304884?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:31:38.01847+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"646931b8-58da-4800-8be6-21a6c0b334fd\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:27:36.7101105+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"190d3f6d-9dd2-4aee-865b-d85385304884\"\r\n}" headers: cache-control: - no-cache content-length: - - '132' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:32:08 GMT + - Thu, 06 Jan 2022 08:28:06 GMT expires: - '-1' pragma: @@ -997,7 +1090,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29905 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29918 status: code: 200 message: OK @@ -1011,23 +1104,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/646931b8-58da-4800-8be6-21a6c0b334fd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/190d3f6d-9dd2-4aee-865b-d85385304884?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:31:38.01847+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"646931b8-58da-4800-8be6-21a6c0b334fd\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:27:36.7101105+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"190d3f6d-9dd2-4aee-865b-d85385304884\"\r\n}" headers: cache-control: - no-cache content-length: - - '132' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:32:38 GMT + - Thu, 06 Jan 2022 08:28:36 GMT expires: - '-1' pragma: @@ -1044,7 +1137,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29902 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29915 status: code: 200 message: OK @@ -1058,23 +1151,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/646931b8-58da-4800-8be6-21a6c0b334fd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/190d3f6d-9dd2-4aee-865b-d85385304884?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:31:38.01847+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"646931b8-58da-4800-8be6-21a6c0b334fd\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:27:36.7101105+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"190d3f6d-9dd2-4aee-865b-d85385304884\"\r\n}" headers: cache-control: - no-cache content-length: - - '132' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:33:07 GMT + - Thu, 06 Jan 2022 08:29:06 GMT expires: - '-1' pragma: @@ -1091,7 +1184,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29899 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29912 status: code: 200 message: OK @@ -1105,24 +1198,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/646931b8-58da-4800-8be6-21a6c0b334fd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/190d3f6d-9dd2-4aee-865b-d85385304884?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:31:38.01847+00:00\",\r\n \"endTime\": - \"2021-10-12T07:33:26.6753245+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"646931b8-58da-4800-8be6-21a6c0b334fd\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:27:36.7101105+00:00\",\r\n \"endTime\": + \"2022-01-06T08:29:30.9914325+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"190d3f6d-9dd2-4aee-865b-d85385304884\"\r\n}" headers: cache-control: - no-cache content-length: - - '182' + - '184' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:33:37 GMT + - Thu, 06 Jan 2022 08:29:36 GMT expires: - '-1' pragma: @@ -1139,7 +1232,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29896 + - Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29909 status: code: 200 message: OK @@ -1153,10 +1246,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/646931b8-58da-4800-8be6-21a6c0b334fd?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/190d3f6d-9dd2-4aee-865b-d85385304884?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1166,7 +1259,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:33:37 GMT + - Thu, 06 Jan 2022 08:29:36 GMT expires: - '-1' pragma: @@ -1179,7 +1272,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29895 + - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29908 status: code: 200 message: OK @@ -1195,7 +1288,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetb172129e/virtualmachines/0/reimageall?api-version=2021-07-01 @@ -1204,17 +1297,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/03bf3af0-ac02-429d-a326-677e60ef6fe0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7b84a1e4-d3e1-4ea8-a05c-dcc93df85886?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:33:38 GMT + - Thu, 06 Jan 2022 08:29:36 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/03bf3af0-ac02-429d-a326-677e60ef6fe0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7b84a1e4-d3e1-4ea8-a05c-dcc93df85886?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1225,7 +1318,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1189,Microsoft.Compute/VMScaleSetVMActions3Min;198,Microsoft.Compute/VMScaleSetVMActions30Min;996,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3723,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/VMScaleSetActions3Min;238,Microsoft.Compute/VMScaleSetActions30Min;1189,Microsoft.Compute/VMScaleSetVMActions3Min;198,Microsoft.Compute/VMScaleSetVMActions30Min;996,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3726,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-writes: - '1179' x-ms-request-charge: @@ -1243,23 +1336,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/03bf3af0-ac02-429d-a326-677e60ef6fe0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7b84a1e4-d3e1-4ea8-a05c-dcc93df85886?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:33:38.894173+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"03bf3af0-ac02-429d-a326-677e60ef6fe0\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:29:37.2101224+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"7b84a1e4-d3e1-4ea8-a05c-dcc93df85886\"\r\n}" headers: cache-control: - no-cache content-length: - - '133' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:34:08 GMT + - Thu, 06 Jan 2022 08:30:07 GMT expires: - '-1' pragma: @@ -1276,7 +1369,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29892 + - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29924 status: code: 200 message: OK @@ -1290,23 +1383,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/03bf3af0-ac02-429d-a326-677e60ef6fe0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7b84a1e4-d3e1-4ea8-a05c-dcc93df85886?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:33:38.894173+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"03bf3af0-ac02-429d-a326-677e60ef6fe0\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:29:37.2101224+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"7b84a1e4-d3e1-4ea8-a05c-dcc93df85886\"\r\n}" headers: cache-control: - no-cache content-length: - - '133' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:34:38 GMT + - Thu, 06 Jan 2022 08:30:36 GMT expires: - '-1' pragma: @@ -1323,7 +1416,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29889 + - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29921 status: code: 200 message: OK @@ -1337,24 +1430,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/03bf3af0-ac02-429d-a326-677e60ef6fe0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7b84a1e4-d3e1-4ea8-a05c-dcc93df85886?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:33:38.894173+00:00\",\r\n \"endTime\": - \"2021-10-12T07:35:08.1443738+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"03bf3af0-ac02-429d-a326-677e60ef6fe0\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:29:37.2101224+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"7b84a1e4-d3e1-4ea8-a05c-dcc93df85886\"\r\n}" headers: cache-control: - no-cache content-length: - - '183' + - '134' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:35:08 GMT + - Thu, 06 Jan 2022 08:31:06 GMT expires: - '-1' pragma: @@ -1371,7 +1463,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29900 + - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29918 status: code: 200 message: OK @@ -1385,10 +1477,58 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/03bf3af0-ac02-429d-a326-677e60ef6fe0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7b84a1e4-d3e1-4ea8-a05c-dcc93df85886?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + response: + body: + string: "{\r\n \"startTime\": \"2022-01-06T08:29:37.2101224+00:00\",\r\n \"endTime\": + \"2022-01-06T08:31:13.4443387+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"7b84a1e4-d3e1-4ea8-a05c-dcc93df85886\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '184' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 06 Jan 2022 08:31:37 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29915 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/7b84a1e4-d3e1-4ea8-a05c-dcc93df85886?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 response: body: string: '' @@ -1398,7 +1538,7 @@ interactions: content-length: - '0' date: - - Tue, 12 Oct 2021 07:35:08 GMT + - Thu, 06 Jan 2022 08:31:37 GMT expires: - '-1' pragma: @@ -1411,7 +1551,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29899 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29914 status: code: 200 message: OK @@ -1427,7 +1567,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/virtualmachinescalesetb172129e?api-version=2021-07-01 @@ -1438,17 +1578,17 @@ interactions: azure-asyncnotification: - Enabled azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2546b4a9-d861-4438-b62e-0bbe3c171cc0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/e709703a-47d8-43f6-90d3-335328cc3b98?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 cache-control: - no-cache content-length: - '0' date: - - Tue, 12 Oct 2021 07:35:09 GMT + - Thu, 06 Jan 2022 08:31:37 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2546b4a9-d861-4438-b62e-0bbe3c171cc0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/e709703a-47d8-43f6-90d3-335328cc3b98?p=54253b73-cb53-496f-ab42-5e5ee19426f8&monitor=true&api-version=2021-07-01 pragma: - no-cache server: @@ -1459,7 +1599,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/DeleteVMScaleSet3Min;79,Microsoft.Compute/DeleteVMScaleSet30Min;397,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3723,Microsoft.Compute/VmssQueuedVMOperations;0 + - Microsoft.Compute/DeleteVMScaleSet3Min;79,Microsoft.Compute/DeleteVMScaleSet30Min;397,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;3726,Microsoft.Compute/VmssQueuedVMOperations;0 x-ms-ratelimit-remaining-subscription-deletes: - '14993' x-ms-request-charge: @@ -1477,14 +1617,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2546b4a9-d861-4438-b62e-0bbe3c171cc0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/e709703a-47d8-43f6-90d3-335328cc3b98?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:35:09.9881199+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"2546b4a9-d861-4438-b62e-0bbe3c171cc0\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:31:37.7102169+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"e709703a-47d8-43f6-90d3-335328cc3b98\"\r\n}" headers: cache-control: - no-cache @@ -1493,7 +1633,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:35:20 GMT + - Thu, 06 Jan 2022 08:31:47 GMT expires: - '-1' pragma: @@ -1510,7 +1650,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14980,Microsoft.Compute/GetOperation30Min;29897 + - Microsoft.Compute/GetOperation3Min;14981,Microsoft.Compute/GetOperation30Min;29913 status: code: 200 message: OK @@ -1524,14 +1664,14 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2546b4a9-d861-4438-b62e-0bbe3c171cc0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/e709703a-47d8-43f6-90d3-335328cc3b98?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:35:09.9881199+00:00\",\r\n \"status\": - \"InProgress\",\r\n \"name\": \"2546b4a9-d861-4438-b62e-0bbe3c171cc0\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:31:37.7102169+00:00\",\r\n \"status\": + \"InProgress\",\r\n \"name\": \"e709703a-47d8-43f6-90d3-335328cc3b98\"\r\n}" headers: cache-control: - no-cache @@ -1540,7 +1680,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:35:31 GMT + - Thu, 06 Jan 2022 08:31:58 GMT expires: - '-1' pragma: @@ -1557,7 +1697,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29896 + - Microsoft.Compute/GetOperation3Min;14980,Microsoft.Compute/GetOperation30Min;29912 status: code: 200 message: OK @@ -1571,24 +1711,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.12 (Linux-5.8.0-1042-azure-x86_64-with-glibc2.2.5) + - azsdk-python-azure-mgmt-compute/24.0.0 Python/3.8.12 (Linux-5.11.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/2546b4a9-d861-4438-b62e-0bbe3c171cc0?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/operations/e709703a-47d8-43f6-90d3-335328cc3b98?p=54253b73-cb53-496f-ab42-5e5ee19426f8&api-version=2021-07-01 response: body: - string: "{\r\n \"startTime\": \"2021-10-12T07:35:09.9881199+00:00\",\r\n \"endTime\": - \"2021-10-12T07:35:54.2225675+00:00\",\r\n \"status\": \"Succeeded\",\r\n - \ \"name\": \"2546b4a9-d861-4438-b62e-0bbe3c171cc0\"\r\n}" + string: "{\r\n \"startTime\": \"2022-01-06T08:31:37.7102169+00:00\",\r\n \"endTime\": + \"2022-01-06T08:32:11.210962+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"name\": \"e709703a-47d8-43f6-90d3-335328cc3b98\"\r\n}" headers: cache-control: - no-cache content-length: - - '184' + - '183' content-type: - application/json; charset=utf-8 date: - - Tue, 12 Oct 2021 07:36:00 GMT + - Thu, 06 Jan 2022 08:32:28 GMT expires: - '-1' pragma: @@ -1605,7 +1745,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29894 + - Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29911 status: code: 200 message: OK diff --git a/shared_requirements.txt b/shared_requirements.txt index b5c8b4fc5a4b..8ed53c884c24 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -239,6 +239,8 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-redis azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-recoveryservicesbackup msrest>=0.6.21 #override azure-mgmt-recoveryservicesbackup azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-compute msrest>=0.6.21 +#override azure-mgmt-compute azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-streamanalytics msrest>=0.6.21 #override azure-mgmt-streamanalytics azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-consumption msrest>=0.6.21